Invalid Scope: The requested scope is invalid, unknown, malformed, or exceeds the scope granted to t
My code is the following:
$guzzleClient = new \GuzzleHttp\Client();
$response = $guzzleClient->post('https://api.sandbox.ebay.com/identity/v1/oauth2/token', [
'headers' => [
'Authorization' => 'Basic ' . $oauthToken,
'Content-Type' => 'application/x-www-form-urlencoded',
'Accept' => 'application/json',
],
'form_params' => [
'grant_type' => 'client_credentials',
'scope' => 'https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly'
]
]);I get t he following response:
But https://api.ebay.com/oauth/api_scope is the only scope that works.
This is the OathScopes window:
2 comments
shipscript
·2 years ago@simbia6
The displayed code is mixing a user-token call with application-token parameters.
https://developer.ebay.com/api-docs/static/authorization_guide_landing.html
When using an API to browse, like a guest, no access is required to get into a user account, so the generalized "client credential" for the application is sufficient. A token will be issued that must be renewed every two hours.
https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html
When accessing a user account to manage fulfillment, a "user authentication" process is required to obtain permission and to mint a token to access the user's eBay account. The process starts with obtaining a 5-minute consent from the user.
https://developer.ebay.com/api-docs/static/oauth-consent-request.html
That consent is then converted to an 18-month user token, that requires a 2-hour refresh token.
https://developer.ebay.com/api-docs/static/oauth-auth-code-grant-request.html
simbia6
OP2 years agoHi, thanks for reply. My goal is to retreive the orders by REST API. I still dont understand what I'm doing wrong.
If understand, I have to first make
GET https://auth.sandbox.ebay.com/oauth2/authorize
then.
POST https://api.sandbox.ebay.com/identity/v1/oauth2/token
This is my new code (for the first request):
however I get the following error
What am I doing wrong?