Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getReceipts() throwing 'HTTP status code [403] with error "No user was provided as part of the bearer token.".' #13

Closed
guerrillacontra opened this issue Jul 20, 2022 · 3 comments

Comments

@guerrillacontra
Copy link

Using an up to date version of your SDK I am wrapping it and ran into that exception:

Etsy\Exception\RequestException 

  Received HTTP status code [403] with error "No user was provided as part of the bearer token.".

  at vendor/rhysnhall/etsy-php-sdk/src/OAuth/Client.php:133
    129▕         $response->error = "{$body->error}";
    130▕         $response->code = $status_code;
    131▕         return $response;
    132▕       }
  ➜ 133▕       throw new RequestException(
    134▕         "Received HTTP status code [$status_code] with error \"{$body->error}\"."
    135▕       );
    136▕     }
    137▕   }

The function I am trying to create looks like this:

    public function getOrders() {
        $etsy = new Etsy($this->api_key, $this->access_token);

        /** @var Shop $shop */
        $shop = $etsy->getShop($this->shop_id);

        //All works I can dd($shop) with results :)


        //This is what is throwing it
        return $shop->getReceipts(['limit'=>10, 'was_paid'=>true]);
    }

Seems to be that 'getReceipts' call.

Thank you for this SDK so far I like where it is heading, just a small snag for now maybe I am doing something wrong?

'getShop()' works correctly and returns valid correct JSON so I think it is just that other call.

@rhysnhall
Copy link
Owner

Working fine on my end. Before I look further, 403 is an authorization response, so can you confirm that the permissions scope includes transactions_r and that the user you are requesting the receipts for is the one associated with your access token?

@guerrillacontra
Copy link
Author

It is probably an access issue, I will look into it when I have the time thank you for the guidance :)

@guerrillacontra
Copy link
Author

Update: Turns out I was given an old API key for the V2 etsy API, so generating a new etsy app for it and will try again once approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants