-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Add example with Magic authentication #11810
Conversation
Should i close my PR? I think having official example is better. |
That sounds good @emwsc, and thanks so for the work in your PR! The environment variable stuff was really useful. Thought I'd add our passport-magic in the example so that developers can learn how to do session management themselves with Magic if they like. |
@seanli In the login api route you use express, probably for passport compatibility. There is one caveat, Micro (That's what the API Routes use) lacks a
|
@janus-reith I tried to be as consistent as possible with the Also Magic doesn't use oauth and doesn't force redirects, it adopts a decentralized identity (https://w3c-ccg.github.io/did-primer/) architecture where users sign claims with their own private key instead of a trusted 3rd party centralized identity provider, which give developers more flexibility to decide whether to redirect or not. (More about our architecture: https://docs.magic.link/security) Let me know what you think and whether I should stay consistent with the |
@seanli You're right, TBH I didn't check that example before and just noticed yours, I'd suggest the same for that other one aswell then. But that's just my opinion, it's probably best to wait for the opinion of the core nextjs dev team what would be better before you put effort into changing it. |
This is incorrect, API routes do not use Micro. |
Removed Download manually section from README Co-Authored-By: Joe Haddad <[email protected]>
This is an alternative to Express: #11747 - If there's an even better alternative it's also welcome. I'll review the PR soon 😌 |
examples/magic/README.md
Outdated
|
||
## How to use | ||
|
||
### Using `create-next-app` |
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.
@Timer Should we remove this title too?
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.
Oh, I'm sorry for spreading misinformation then, I was under the assumption. |
@janus-reith in general saying it's Micro-like causes confusion as Micro has a bunch of functionality that we intentionally left out of API routes, eg async bootup (not compatible with serverless functions), the JSON parsing function is separate and not automatic ( |
@timneutkens oh, agreed, so it really is not helpful to compare to micro at all. Thank you for the details! |
Converted status to draft, thinking of removing the express dependencies to make the example more native and lightweight |
Like mine initial PR? :) |
@seanli 💯. I'll be reviewing the PR soon, thank you |
Hi @seanli The example is great!, and also the UI of magic.link is awesome, good work 💯 I have 3 commits to do, unfortunately I keep getting access denied when trying to push to your branch, can you check that updates from collaborators is enabled 🙏 |
Super awesome to hear that - thanks so much @lfades! 🔥 I just sent over a collaborator invite to you https://github.com/fortmatic/next.js/invitations - let me know if this works! 🙏 |
@seanli Thank you for inviting me so quickly to your fork (you can remove me now), I don't know why sometimes I get blocked by authentication in PRs 😕 |
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.
@seanli Thank you for your hard work on this example 🥇
@seanli I changed the readme instrutions to make them more detailed about what to do (similar to the cms examples), and also renamed the example to be |
Ah gotcha - thanks so much for the help reviewing and updating it @lfades! Super excited for this and adding it to our tutorial! 😄Let me know what's next, I do see "This branch is out-of-date with the base branch" should I update the branch or do you got it from here? |
Merged, I was waiting for the linter to be okay 😄 |
This is awesome! Thanks man, it was a lot of fun ⭐️ |
Hi I'm Sean, co-founder of Magic! This pull request adds an official example of using Magic to implement cookie-based, passwordless authentication with email-based magic links.
This work is based on the existing
with-passport
example (following existing layout and styles), removed dependencies on passport and express, and influenced by @emwsc's Pull Request: #11678Demo: https://magic-next.lisean.now.sh