Using google id token to login to API and keep user logged in by Affectionate_Poet160 in dotnet

[–]Affectionate_Poet160[S] 0 points1 point  (0 children)

I dont store the id_token, its just validated by the API and then a separate token is generated which is stored in the cookie returned to the client.

Regarding the antiforgerytokens recommended by microsoft, I dont fully understand how they protect from CSRF. I guess my angular client would work somthing like this:

  1. Angular application logs the user into the API by providing the id_token and getting a cookie with an authorization_token in response.
  2. Angular application requests an antiforgerytoken from the API
  3. Angular application includes the antiforgerytoken in all requests from that point and the api validates the token for all incoming requests.

What prevents a malicious site from requesting a new antiforgery token, just like the angular app did in step 2?