0

I am trying to add google based authentication to my app. Here is what I am doing

  1. using passport-google-oauth20 module for passport google strategy on my express.js server side
  2. I have create two endpoints, first auth/google and second auth/google/callback which is a callback url for google-Oauth
  3. In the strategy definition I am trying to create a jwt token which I want to somehow send to client.
  4. On the client side which is a vue app, I have added google sign-in button which redirects on click to my endpoint created in server,
  5. After that, exchange of accessTokens and scoped informations happens in the server side (where I am generating a jwt token as well). But I am wondering how can I get the access token back to the client after the authentication is successful on the server.

Note that I can't make an ajax call as it will raise cors issue. Any suggestions are highly appreciated ;

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Roshan
  • 150
  • 16

1 Answers1

0

can you please elaborate in detail, is the back-end node server in your control, because if it is then you should be able to set the CORS policy for your front-end application.

  • hey, I have control to the node server, but the problem here is that the OAuth2 auth doesn't support ajax call. https://stackoverflow.com/questions/43276462/cors-issue-while-making-an-ajax-request-for-oauth2-access-token . – Roshan Feb 13 '20 at 14:13
  • If you are using an OAuth2 means you are already relying on some API for authentication then why do you want it to return a JWT Token? because by default the OAuth2 should return an access token – Prafulla Raichurkar Feb 13 '20 at 15:14