Request had insufficient authentication scopes. #394
-
Hello, I have an Android application with multiple subscriptions. I want to validate these receipts via my Laravel backend. SubService.php: <?php
namespace App\Services;
use Illuminate\Support\Facades\Validator;
use App\Enums\ResponseMessageEnums;
use App\Enums\SubscriptionMessageEnums;
use App\Models\User;
use Illuminate\Http\Request;
use Imdhemy\GooglePlay\Subscriptions\SubscriptionPurchase;
use Imdhemy\Purchases\Facades\Subscription;
class SubService {
public static function validateSubscription(Request $request) {
$validator = Validator::make(request()->all(), [
'itemId' => 'required|string',
'purchaseToken' => 'required|string',
], [
'itemId.required' => SubscriptionMessageEnums::INVALID_ITEM_ID,
'itemId.string' => SubscriptionMessageEnums::INVALID_ITEM_ID,
'purchaseToken.required' => SubscriptionMessageEnums::INVALID_PURCHASE_TOKEN,
'purchaseToken.string' => SubscriptionMessageEnums::INVALID_PURCHASE_TOKEN,
]);
if($validator->fails()) {
return ['response' => ['message' => $validator->errors()->first()], 'status' => 400];
}
$itemId = $validator->validated()['itemId'];
$purchaseToken = $validator->validated()['purchaseToken'];
$subscriptionReceipt = Subscription::googlePlay()->id($itemId)->token($purchaseToken)->get();
return ['response' => ['data' => 'test'], 'status' => 200];
}
} I have created api key on google cloud, with 100% permissions.
What can cause this? I couldnt find any workarounds and i searched everywhere but i couldnt find any solution. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Salam @erenkulaksiz |
Beta Was this translation helpful? Give feedback.
Salam @erenkulaksiz
This issue is related to the Google credentials, not the library. Sometimes it takes a little bit of time to work as expected. This guide may help you fixing the scope issue. https://imdhemy.com/laravel-iap-docs/docs/credentials/google-play