繁体   English   中英

Android应用内结算订阅验证

[英]Android in-app billing subscription verifying

我想验证服务器上的订阅,但是在尝试获取访问令牌时收到invalid_grant错误。 我在服务器上的php中使用该代码:

$refreshToken = '4/cTphJ...';
$clientId = '1234567.apps.googleusercontent.com';
$clientSecret = '';
$redirectUri = 'https://www.example.com/oauth2callback';

$ch = curl_init();

$url  = 'https://accounts.google.com/o/oauth2/token';

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'grant_type=authorization_code&client_id=' . $clientId . '&client_secret=' . $clientSecret . '&code=' . $refreshToken . '&redirect_uri=' . $redirectUri);

$data = curl_exec($ch);

curl_close($ch);

有什么事吗

编辑:当我生成正确的代码时,我不再收到invalid_grant错误,但现在却收到错误消息“此开发人员帐户不拥有该应用程序”。 我的Android应用程序和Google控制台中的新API项目是使用相同的Google帐户创建的,为什么我会看到该错误?

是我的错 我称该网址为https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&redirect_uri=...&client_id= ...但我redirect_uri是错误的,然后我得到了错误的代码。

我在开发者控制台设置中的电子邮件有误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM