How to implement token based authentication in oauth2.0 process

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to implement token based authentication in oauth2.0 process



Below is my understanding of the process of oauth2.0(using google as the oauth2.0 server)



my customer click 'login with google account' button on client side.



the browser redirect to google's login page.



my customer inputs it's credential and click 'login'.



if my customer succeeded in previous step,the browser will redirect to my server's url
(www.[myserver].com/auth/google/callback) with some extra query
data.



then my server will do some work to get some token from google and finally get my customer's information.



My question comes from the next step. I want to use token based authentication.Then I have to make my customer to store my own token in localStorage. I can't figure out how to achieve this in the 6th step(how to send a new token to client side and store it in localStorage?).
(I know that every thing will be easy if I am using cookie-based authentication. because I can just utilize 'set-cookie' in the 6th step, and the client side will be easily store the credential data in client side's cookie)




2 Answers
2



Google APIs use the OAuth 2.0 protocol for authentication and authorization. Google supports common OAuth 2.0 scenarios such as those for web server, installed, and client-side applications.





You are saying what OP already knows
– Emeeus
Aug 7 at 18:01



I figure out that I can use some type of template engine on my server side(just like discussed here). So I can render my template file using variable before send it to my customer.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered