Tim
Tim

Reputation: 3803

Google + OAuth2 Callback to Angular

I am having problem implementing Google Plus Web Server authentication

https://developers.google.com/accounts/docs/OAuth2WebServer

I have implemented most of the steps, until the last step, I have no idea how to make a callback with token to my Angular.JS,

I found an article which solves my problem (and it has the same implementation as mine):

http://apicatus-laboratory.rhcloud.com/2014/04/13/handling-oauth-callbacks-in-spa/

But, I have few questions for this article,

Upvotes: 1

Views: 1465

Answers (1)

nvnagr
nvnagr

Reputation: 2063

Why not use this flow that is meant for javascript applications?

https://developers.google.com/+/web/signin/javascript-flow

& https://developers.google.com/accounts/docs/OAuth2UserAgent

You can get an id_token (it is JWT) directly from Google in JS and use that.

What the article is trying to do is to get the Google Oauth response to the server and issue it's own JWT just like any site would issue its own authentication cookies and use those in the application.

Both are possible options depending on the goal of your application.

Upvotes: 2

Related Questions