-
Notifications
You must be signed in to change notification settings - Fork 15
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
Added django auth backend to support magic login #25
base: master
Are you sure you want to change the base?
Conversation
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.
Left some comments for places that need clean-up or places where I'm not sure about the code.
It'll be great if your team could fix these issues(I'm really tight on my schedule as ETh Denver is approaching). But in the worst case, I can clean it myself if your team doesn't have the bandwidth either
@@ -1,2 +1,3 @@ | |||
requests==2.22.0 | |||
web3==5.4.0 | |||
Django==2.2.1 |
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.
this should be a range instead of pinning it to a specific version.
try: | ||
Magic().Token.validate(identity_token) | ||
except ( | ||
DIDTokenError, |
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.
Not sure about these exceptions, I just imported all the existing errors and plugged them here. I'm not sure what's the intended behavior here.
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.
DIDTokenError
is the only error that you need to try-catch here as the validate
method will only raise the DIDTokenError
.
https://docs.magic.link/admin-sdk/python/api-reference#validate and https://docs.magic.link/admin-sdk/python/api-reference#errors have information on the admin sdk error handling. Let me know if this answers your questions.
# from fortmatic.config import LOGGER_NAME | ||
|
||
|
||
LOGGER_NAME = 'magic' |
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.
This should probably be picked up from the config.
|
||
LOGGER_NAME = 'magic' | ||
|
||
LOG_LEVEl = 'debug' |
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.
This should probably be picked up from the config.
try: | ||
Magic().Token.validate(identity_token) | ||
except ( | ||
DIDTokenError, |
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.
Not sure about these exceptions, I just imported all the existing errors and plugged them here. I'm not sure what's the intended behavior here.
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.
See #25 (comment)
No description provided.