Thursday, 25 May 2017

How to use Google OAuth to authenticate on the backend?

I have a React signs into Google using OAuth 2. I also have a node/express REST api that creates users. How do I authenticate the user using the data I receive when I login on the React app?

I've been trying to follow this: https://developers.google.com/identity/sign-in/web/backend-auth but the token I get from Google on login expires after an hour, so I can't use it to authenticate the user on the backend after that. So, how to I get a new token or a token that won't expire without logging in again?

I'm sure this is done on a million different websites across the internet, but I can't find any good documentation or guide on how.



via baron816

No comments:

Post a Comment