GooglePay获取refresh_token

两个地址:
1、https://play.google.com/apps/publish/  (关联)

2、https://console.developers.google.com/apis/credentials 获取client_id / 配置域名 redirect_uri

步骤

一、

https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&redirect_uri={redirect_uri}&client_id={client_id}

>> 浏览器跳转

二、

步骤一会重定向到

https://你配置域名/?code=4/qwHH1AKDWz-cYn6eIzthPVXyfnrEFhyA_lRWJNxYkM&scope=https://www.googleapis.com/auth/androidpublisher

>> 记录code

三、

POST

https://accounts.google.com/o/oauth2/token

参数:

'grant_type'=>'authorization_code',

'code'=>'第二步获取的code',

'client_id'=>'....',

'client_secret'=>'....',

'redirect_uri'=>'redirect_uri',

结果:

>>>>

{

    "access_token": "...",

    "expires_in": 3600,

    "refresh_token": "...",//保存

    "scope": "https://www.googleapis.com/auth/androidpublisher",

    "token_type": "Bearer"

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容