我的 Google oAuth2 令牌看起来正确吗? [英] Does my Google oAuth2 Token look right?

查看:18
本文介绍了我的 Google oAuth2 令牌看起来正确吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写 Web 服务器以支持 Google API 的 oAuth2,并且正在关注 本文档.在我尝试使用访问令牌制作 Google API 之前,一切似乎都运行良好.来自文档的示例调用:

I am programming a web server to support oAuth2 for Google APIs and am following this documentation. Everything seems to be working fine up to the point where I try to make a Google API using the Access Token. Example call from the documentation:

https://www.googleapis.com/oauth2/v1/userinfo?access_token=1/fFBGRNJru1FQd44AzqT3Zg

当我用我的访问令牌尝试它时,我收到 401 invalid token 错误.

When I try it with my access token I get 401 invalid token error.

翻阅文献,所有示例都以 1/fFBGR...... 格式显示访问令牌.我的访问令牌的格式为 ya29.AHES67z....... 并且更长(请参阅下面包含来自 google 的响应的片段).

Looking through the literature, all examples show the Access Token in format 1/fFBGR....... My Access Token is of form ya29.AHES67z....... and is much longer (see the snippet below containing response from google).

oauth2 request:{
"access_token" : "ya29.AHES67zeEn-RDg9CA5gGKMLKuG4uVB7W4O4WjNr-NBfY6Dtad4vbIZ",
"token_type" : "Bearer",
"expires_in" : 3600
}

所以看起来我的令牌不正确.我必须编码/解码它吗?

So it appears my token is incorrect. Do I have to encode/decode it?

推荐答案

我最近一直在玩 VBA 的 OAuth2.0.

I've been recently playing around with OAuth2.0 from VBA.

Authorization Code Begins With: 4/Omoy    (30 Characters Long)  
Access_Token Begins With:       ya29.AHES (60 Characters Long)    
Refresh_Token Begins With:      1/Ry68    (45 Characters Long)  

我无需进行任何解码或编码即可使用这些值.这些都是有效的、功能性的价值.

I didn't have to do any decoding or encoding to use these values. These were working, functional values.

这篇关于我的 Google oAuth2 令牌看起来正确吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆