-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
29/Remove token #56
29/Remove token #56
Conversation
@@ -7,9 +7,15 @@ const bodyParser = require("body-parser"); | |||
// Firebase set up | |||
const firebaseAdmin = require("firebase-admin"); | |||
const firebaseServiceAccount = require("./firebaseServiceAccountKey.json"); | |||
const { userOnly, adminOnly } = require("./middlewares/auth"); | |||
const { withAddress } = require("./middlewares/auth"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another idea for this middleware name: withProviderAddress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provider sounds a bit too ambiguous to me. What about withConnectedAddress
or withWalletAddress
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposed «provider» since it's how it's called on the frontend (userProvider, injectedProvider, localProvider). But I like withConnectedAddress
also.
|
||
req.address = addressToken; | ||
req.isAdmin = tokenContents.claims.isAdmin; | ||
const withAddress = (req, res, next) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we want to return a 401 (or other error status code) if the address is not present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, makes sense. We can tackle the two comments on the open PR #55
Fix #29
As stated in #29:
Opening the PR against the branch for #46 because that branch will need these changes.
I left a dummy middleware alerting that admins are not checked anymore. That should be solved in #51.