You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Authorization for Grantless Operations in Selling Partner API
285
+
286
+
[Please, see more details in Selling Partner Api docs](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#grantless-operations-1)
287
+
288
+
```php
289
+
<?php
290
+
include __DIR__ . '/vendor/autoload.php';
291
+
292
+
/** The Setup **/
293
+
294
+
$config = [
295
+
//Guzzle configuration
296
+
'http' => [
297
+
'verify' => false,
298
+
'debug' => true
299
+
],
300
+
301
+
//LWA: Keys needed to obtain access token from Login With Amazon Service
302
+
'refresh_token' => '<YOUR-REFRESH-TOKEN>',
303
+
'client_id' => '<CLINET-ID-IN-SELLER-CONSOLE>',
304
+
'client_secret' => '<CLIENT_SECRET>',
305
+
306
+
//STS: Keys of the IAM role which are needed to generate Secure Session
307
+
// (a.k.a Secure token) for accessing and assuming the IAM role
308
+
'access_key' => '<STS-ACCESS_KEY>',
309
+
'secret_key' => '<STS-SECRET-KEY>',
310
+
'role_arn' => '<ROLE-ARN>' ,
311
+
312
+
//API: Actual configuration related to the SP API :)
313
+
'region' => 'eu-west-1',
314
+
'host' => 'sellingpartnerapi-eu.amazon.com'
315
+
];
316
+
317
+
//Create token storage which will store the temporary tokens
318
+
$tokenStorage = new DoubleBreak\Spapi\SimpleTokenStorage('./aws-tokens');
319
+
320
+
//Create the request signer which will be automatically used to sign all of the
321
+
//requests to the API
322
+
$signer = new DoubleBreak\Spapi\Signer();
323
+
324
+
//Create Credentials service and call getCredentials() to obtain
325
+
//all the tokens needed under the hood
326
+
$credentials = new DoubleBreak\Spapi\Credentials($tokenStorage, $signer, $config);
327
+
//get credentials with Grantless auth token, it's needed for grantless operations request
0 commit comments