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"

}

你可能感兴趣的:(GooglePay获取refresh_token)