使用google API取得的Access Token,可以透過以下網址直接查詢對應的Info
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=
正確的話會顯示
1 | { |
失敗的話則會顯示
1 | { |
也可以查詢id token的info
https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=
預期回傳如下1
2
3
4
5
6
7
8
9
10
11
12
13{
iss: "accounts.google.com",
at_hash: "qqqqqqqqqqqqqqqqqqqqqqqqqqq",
aud: "99999999999-99999999999.apps.googleusercontent.com",
sub: "99999999999",
email_verified: "true",
azp: "99999999999-99999999999.apps.googleusercontent.com",
email: "test@gmail.com",
iat: "1463550722",
exp: "1463554322",
alg: "RS256",
kid: "99999999999"
}
其中,sub其實就是google’s userId
如何透過線上工具直接取得access token呢?
可以使用oauthplayground