Redirecting and Authentication using Google Identity Sign in (React and Nodejs)

Viewed 817

So I'm designing a dashboard, and it has 2 parts, the login page, and then dashboard itself.

I'm using the new Identity sign in by Google, React, Nodejs, and React Router v6.

And I login and get the JWT, I store it in sessionStorage and I can use that to verify whether the user is logged in or not using the function Google has given here.

https://developers.google.com/identity/gsi/web/guides/verify-google-id-token#node.js

Now this is where I'm facing issues.

  1. How do I successfully redirect the user to the dashboard after a successful login?

  2. How do I protect my dashboard from un-signed users?

I found some implementations but they use Redirect, and that's not available in v6.

Thank you for reading!

0 Answers
Related