android 谷歌Google 安卓获得授权id Token后给PHP服务器 调用验证 获取信息

2023-08-28sad creeper

$idToken = 'eyJhbGciOiJSUzI1NiIsImtpZCI6ImMzYWZlN2E5YmRhNDZiYWU2ZWY5N2U0NmM5NWNkYTQ4OTEyZTU5NzkiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhenAiOiI1ODY1OTA3MTA0MC1tODgzYmkxdmVvMmRlaDBubGs2c2J1dGZzY2RyMDMzNy5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsImF1ZCI6IjU4NjU5MDcxMDQwLWJhZDQ2c3RjZmtnaDdtcjN0bmp1b2NpY29zaHN2bXJiLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwic3ViIjoiMTA1MjQwOTM3MjU2NjIyNDUwNDQ2IiwiZW1haWwiOiJnZ2NyZWF0b3J6QGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJuYW1lIjoi5ZGo5piTIiwicGljdHVyZSI6Imh0dHBzOi8vbGgzLmdvb2dsZXVzZXJjb250ZW50LmNvbS9hL0FBY0hUdGVnVVBpemdGZmtzWFVNNDNxYmlIbDN0MmlNNVN_Ik-C9dJF_EVezJtv5sHzqYRc1cOCDr8NDc88AkcGAtw'; // 替换为您获得的 Google Access Token

$client = new Google_Client(['client_id' => '586040-ba.apps.googleusercontent.com']);
$payload = $client->verifyIdToken($idToken);
var_dump($payload);die();

composer require google/apiclient
官方文档:https://developers.google.com/identity/sign-in/android/backend-auth?hl=zh-cn


输出信息:
array(13) {
["iss"]=>
string(27) "https://accounts.google.com"
["azp"]=>
string(71) "50-m883bi37.apps.googleusercontent.com"
["aud"]=>
string(71) "50-barb.apps.googleusercontent.com"
["sub"]=>
string(21) "10520446"
["email"]=>
string(20) "gorz@gmail.com"
["email_verified"]=>
bool(true)
["name"]=>
string(6) "易"
["picture"]=>
string(90) "https://lh3.googleusercontent.com/a/AA0_TtwI=s-c"
["given_name"]=>
string(3) "易"
["family_name"]=>
string(3) ""
["locale"]=>
string(5) "zh-CN"
["iat"]=>
int(1693208505)
["exp"]=>
int(1693212105)
}

阅读 2060 评论


s

site

I do not know if it's just me or if everybody else experiencing issues with your blog. It appears like some of the text on your posts are running off the screen. Can somebody else please comment and let me know if this is happening to them too? This might be a issue with my internet browser because I've had this happen before. Cheers

2天前 ·


s

site

Greetings! Very helpful advice within this post! It's the little changes that produce the largest changes. Thanks for sharing!

2周前 ·


m

myhomehobby

With havin so much content do you ever run into any problems of plagorism or copyright infringement? My website has a lot of unique content I've either written myself or outsourced but it seems a lot of it is popping it up all over the internet without my agreement. Do you know any methods to help stop content from being stolen? I'd genuinely appreciate it.

1个月前 ·


p

priligy 60 mg

Hi there everyone, it's my first visit at this web site, and post is really fruitful in favor of me, keep up posting such posts.

2个月前 ·


p

priligy dosage

What's up friends, how is the whole thing, and what you wish for to say concerning this paragraph, in my view its really remarkable for me.

4个月前 ·