Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

voith
Copy link

@voith voith commented Jan 25, 2021

No description provided.

Copy link
Author

@voith voith left a 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
Copy link
Author

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,
Copy link
Author

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.

Copy link
Contributor

@FYJen FYJen Jan 26, 2021

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'
Copy link
Author

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'
Copy link
Author

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,
Copy link
Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants