I am using the GoogleOAuth2AuthenticationOptions class for authentication in my MVC5 Web App (SPA Template). Given below is the code
var g = new GoogleOAuth2AuthenticationOptions { ClientId = "clientid", ClientSecret = "secret", //CallbackPath="", Provider = new GoogleOAuth2AuthenticationProvider { OnAuthenticated = async ctx => { ctx.Identity.AddClaim(new Claim("urn:tokens:google:accesstoken", ctx.AccessToken)); } } }; // restrict the retrieved information to just signin information g.Scope.Add("openid"); app.UseGoogleAuthentication(g);
The token I get is something like this
ya29.LgAibra6cNLEKCEAAADLJxUOviZRgv9JSm-jrB-lNp16nomUijNrVAbcdDkI60Vg-A9yjFN4abcd_C8b4
I am using this token in subsequent calls to a MVC WebAPI which uses OAuthBearerTokens for security. I send the access token through the header in my WebAPI call from my MVC Web app
app.UseOAuthBearerTokens(OAuthOptions);
The javascript generated on the client contains a much larger token which works with my MVC WebAPI. Does anyone know how to fix this?