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

Clee/docs 240 #19

Merged
merged 10 commits into from
Mar 6, 2024
Merged

Clee/docs 240 #19

merged 10 commits into from
Mar 6, 2024

Conversation

clee-stytch
Copy link
Contributor

Add SMS OTP authentication to the demo app. Tested manually for all new and existing functionalities.

@clee-stytch clee-stytch requested a review from a team as a code owner February 27, 2024 19:37
Copy link

vercel bot commented Feb 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stytch-nextjs13-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 6, 2024 7:30pm

Copy link

@edwin-stytch edwin-stytch left a comment

Choose a reason for hiding this comment

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

@clee-stytch

omg could it actually be...

Screenshot 2024-02-27 at 7 06 35 PM

🪄 ✨ ship it

@chris-stytch
Copy link
Contributor

chris-stytch commented Feb 28, 2024

Couple quick asks:

  • While we're here, would you mind updating the SDK versions to latest? i.e. stytch-node, @stytch/nextjs, and @stytch/vanilla-js

In order to send SMS messages, you must first add your credit card, this is to limit fraud/spam and in case there are incidental charges.

@@ -25,6 +25,8 @@ const Authenticate = () => {
if (stytch && !user && isInitialized) {
const token = searchParams.get("token");
const stytch_token_type = searchParams.get("stytch_token_type");
const code = searchParams.get("code");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this code necessary?

An OTP flow (when using the pre-built UI) doesn't involve a redirect, and thus won't hit this route. The OTP code should be entered (and auth'd) all in the login component completely by the JS SDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah you're right, I've looked through the JS SDK and see that we can grab the user input as part of the state to pass to the authenticate call. Updated!

Copy link
Contributor

Choose a reason for hiding this comment

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

To put a finer point on it, no backend authenticate call is necessary for OTP when you're using our pre-built UI components. Unlike with EML or OAuth, no redirect happens as part of the authentication flow, so the user will never hit the redirect.

So for adding OTP to this app, all we'll need to do is the work in Login.tsx, no other code changes should be necessary to get OTP up and running. Mind removing the changes here to Authenticate.tsx and giving it a test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh woah magic! Okay just updated - appreciate the clarification.

@clee-stytch
Copy link
Contributor Author

Couple quick asks:

  • While we're here, would you mind updating the SDK versions to latest? i.e. stytch-node, @stytch/nextjs, and @stytch/vanilla-js

In order to send SMS messages, you must first add your credit card, this is to limit fraud/spam and in case there are incidental charges.

Done!

Copy link
Contributor

@chris-stytch chris-stytch left a comment

Choose a reason for hiding this comment

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

Let's ship!

@clee-stytch clee-stytch merged commit 6b88d73 into main Mar 6, 2024
4 checks passed
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.

3 participants