为什么使用Google API客户端获得的我的OAuth访问令牌包含大量' ...'
我正在使用PHP来获得FCM的OAuth令牌,但是返回的访问令牌包含很多“ ....”
$client= new \Google_Client();
error_log(__DIR__);
$client->setAuthConfig(__DIR__ . '/service-account-key.json');
$client->addScope('https://www.googleapis.com/auth/firebase.messaging');
$client->refreshTokenWithAssertion();
$token = $client->getAccessToken();
error_log(json_encode($token));
return $token;
结果
实际访问令牌不包含星号(*),它曾经是字符我已经用星号替换,以审查令牌。
{"access_token":"ya29.*.b*************r1FYWFz***CCg3v8VYHTlu*******************hiMIDhSX******6UfwvazfOcuV***********ewuo-c87WgM-ir
S5unipu0goCl3RtC_0g7hkjqNwQ2pcZjmJCZIr7JM5VwD4........................................................................................................................................................................................
......................................................................................................................................................................................................................................
......................................................................................................................................................................................................................................
....................................................................................................................................................","expires_in":3599,"token_type":"Bearer","created":1652776589}
有人可以告诉我为什么它会返回一堆“”。
I am using PHP to get oauth token for FCM however the access token returned contains a lot of '....'
$client= new \Google_Client();
error_log(__DIR__);
$client->setAuthConfig(__DIR__ . '/service-account-key.json');
$client->addScope('https://www.googleapis.com/auth/firebase.messaging');
$client->refreshTokenWithAssertion();
$token = $client->getAccessToken();
error_log(json_encode($token));
return $token;
Result
The actual access token doesnt contain the asterisk(*), it used to be characters that i have replaced with asterisks to censor out the token.
{"access_token":"ya29.*.b*************r1FYWFz***CCg3v8VYHTlu*******************hiMIDhSX******6UfwvazfOcuV***********ewuo-c87WgM-ir
S5unipu0goCl3RtC_0g7hkjqNwQ2pcZjmJCZIr7JM5VwD4........................................................................................................................................................................................
......................................................................................................................................................................................................................................
......................................................................................................................................................................................................................................
....................................................................................................................................................","expires_in":3599,"token_type":"Bearer","created":1652776589}
Can someone please tell me why it is returning a bunch of '.'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尽管返回的访问令牌是填充期(...),但使用该访问令牌发送FCM通知没有问题。阻止我发送通知的问题是由于不遵循正确的有效负载格式来发送数据。
理想的有效载荷格式
Despite the access token being returned is filled periods(...), there is no issue using that access token to send a FCM notification. The issue that prevent me from sending a notification out is due to not following the correct payload format to send out the data.
Ideal payload format