[英]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.