I'm implementing my own login and signup UI's on a NextJS project by following the steps in this blog post: https://supertokens.com/blog/adding-social-login-to-your-website-with-supertokens
I've made a route on the frontend for the callback, but how should I handle redirects? For example, I try to access a secure page, get directed to login, login with google, directs me to the
redirect_uri
, that page handles the
/auth/signinup
, how should I properly handle sending my user back to the initial protected page?
r
rp_st
05/12/2022, 8:40 PM
You can store which page the user came from in local storage before redirecting them to the social provider’s site
rp_st
05/12/2022, 8:40 PM
And when they come back to your app, after successful sign in / up, you can read that value form localstorage and take them back to that page.
m
mwill8886
05/13/2022, 3:49 PM
Thanks. That's pretty much what I ended up doing. I watched what the widget did and mimicked that, though I don't know exactly what the state uid is for other than confirming that the sessionStorage object matches the redirect back from the auth provider.
r
rp_st
05/13/2022, 3:50 PM
Yea. It’s basically to make sure that you end up consuming the code only if you generated it.
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).