jlevers / selling-partner-api

A PHP client library for Amazon's Selling Partner API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Client error: `POST https://api.amazon.com/auth/o2/token` resulted in a `401 Unauthorized` response

YunigeCDilip opened this issue · comments

Problem description:

As you have included refresh_token instead of access_token in whole API documentation, what if refresh_token is expired?
I followed the documentation present here. And used refresh_token in each API. And i 've been in rest for days, now i got this error.
How to renew my refresh token ? as refresh_token is used before now it is expired.

Error:

Client error: POST https://api.amazon.com/auth/o2/token resulted in a 401 Unauthorized response:\n{"error_description":"Client authentication failed","error":"invalid_client"}\n

## Code
        $response = Http::post('https://api.amazon.com/auth/o2/token', [
            'grant_type' => 'refresh_token',
            'refresh_token' => '"Atzr|IwEBI******************",
            'client_id' => config('services.amazon.lwa_app_key'),
            'client_secret' => config('services.amazon.lwa_app_secret'),
        ]);

Was this code working initially? The refresh token never expires, so that shouldn't be the issue.