如何获取虚拟Google访问令牌以测试OAuth Google API [英] How to get dummy google access token to test oauth google api
本文介绍了如何获取虚拟Google访问令牌以测试OAuth Google API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以生成访问令牌以测试用于通过gmail登录的oauth?
Is there any way in which I can generate access token to test oauth for logging in with gmail?
我创建了一个Google应用,并获取了客户端和秘密ID.
I have created a google app, and got the client and secret ids.
我知道facebook会允许您从此URL https://developers.facebook.com执行此操作/tools/accesstoken/
I know facebook will allow you to do so from this url https://developers.facebook.com/tools/accesstoken/
Google是否有这种方法?
Is there any method like this for Google?
推荐答案
使用 Google OAuth游乐场:
请求:
POST /oauth2/v3/token HTTP/1.1
Host: www.googleapis.com
Content-Type: application/x-www-form-urlencoded
code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp7&
client_id=8819981768.apps.googleusercontent.com&
client_secret={client_secret}&
redirect_uri=https://oauth2-login-demo.appspot.com/code&
grant_type=authorization_code
(成功)响应:
{
"access_token":"1/fFAGRNJru1FTz70BzhT3Zg",
"expires_in":3920,
"token_type":"Bearer"
}
我还强烈建议您阅读 Google OAuth 2.0文档
这篇关于如何获取虚拟Google访问令牌以测试OAuth Google API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文