As exercise to understand OpenIDConnect, I am trying to authenticate in my web app with Google following this guide.
The problem is I cannot read the token that Google s
From this post:
“id_token” is encoded in a format called JSON Web Token (JWT). JWT is the concatenation of “header”, “body”, “signature” by periods (.).
So you need to split id_token
on .
and decode just the 2nd segment:
var http = new HttpClient(handler);
var result = await http.PostAsync("https://www.googleapis.com/oauth2/v3/token", postData);
var json = JObject.Parse(await result.Content.ReadAsStringAsync());
var token = Convert.FromBase64String(json.id_token.split('.')[1]);