allegro / allegro-api

Issue tracker and wiki for Allegro REST API
https://developer.allegro.pl/
213 stars 39 forks source link

Unauthorized #9655

Open tongalalal opened 1 month ago

tongalalal commented 1 month ago

When I go to get the authorization information, there is this error, I got the code from the link I redirected, this is the method TOKEN_URL = "https://allegro.pl/auth/oauth/token" authorization_code = "xlVoWUZQN7389DkdVMt44T1PwfJ3l3K3" def get_access_token(authorization_code, code_verifier): try: data = {'grant_type': 'authorization_code', 'code': authorization_code, 'redirect_uri': REDIRECT_URI, 'code_verifier': code_verifier} access_token_response = requests.post(TOKEN_URL, data=data, verify=False, allow_redirects=False) print(access_token_response.text) response_body = json.loads(access_token_response.text) return response_body except requests.exceptions.HTTPError as err: raise SystemExit(err). In addition, I tested the seller account in my sandbox {'error': 'Unauthorized', 'error_description': 'Unauthorized'}

tongalalal commented 1 month ago

I realize that my token_url is the official one, and when I change it to the test one, this problem arises { "errors": [ { "code": "NotFoundException", "message": "Not found", "details": null, "path": null, "userMessage": "Feature unavailable. Contact the application author.", "metadata": {} } ] } Would you please tell me why this is, this is my client_id: e6e597bf52424648b8ea326cc88c7b58, I use my sandbox enterprise seller account registration app then go to authorize me the enterprise sellers account, this is my basic process

tongalalal commented 1 month ago

{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}

MaciejFrackowiak commented 1 month ago

Could you give me a trace-id of your request?

tongalalal commented 1 month ago

@MaciejFrackowiak {"errors":[{"code":"NotFoundException","message":"Not found","details":null,"path":null,"userMessage":"Feature unavailable. Contact the application author.","metadata":{}}]},Sorry,This is the error message prompt returned by my request.,It doesn't seem to have found the word trace_id.,Where can I check this trace_id.

MaciejFrackowiak commented 1 month ago

The trace-id is visible in the response header.

tongalalal commented 1 month ago

@MaciejFrackowiak 2c36c54c16b43305 this my trace_id

tongalalal commented 1 month ago

@MaciejFrackowiak trace-id: 259708d6b38a515e this is my trace_id too

MaciejFrackowiak commented 1 month ago

Based on trace-id you didn't provide a valid token. To use most of the resources you should authorize your account using code or device flow.

tongalalal commented 1 month ago

@MaciejFrackowiak Yes, I am getting the access_token and other information through the code slip, but in the process of requesting, I use my seller account to authorize my application information, and after getting a code in my callback address, I will request this error in the access_token, please ask me which token I have not provided. This is my request header, and some information about the request data, please help me see what the problem is{"errors":[{"code":"NotFoundException","message":"Not found","details":null,"path":null,"userMessage":"Feature unavailable. Contact the application author.","metadata":{}}]} res:<Response [404]> geteway:https://api.allegro.pl.allegrosandbox.pl/auth/oauth/, data:{"grant_type": "authorization_code" , "code": "yDWwzYroc1hfgPpMw637l6QFIdQ0TIKQ", "redirect_uri": "my_redirect_uri"}, headers{"Authorization": "Basic ZTZlNTk3YmY1MjQyNDY0OGI4ZWEzMjZjYzg4YzdiNTg6NTZ1d0RqRzczWG16ZHQ5MEJpRGNUU2QwVU5ZcUU2b3lvazB1N0lSS0NpbHRiRjd0cHhwU2dFdlg0VjAwb2Z4cQ==", "Content-Type": "application/ x-www-form-urlencoded"}

MaciejFrackowiak commented 1 month ago

You are using the wrong auth address --> https://api.allegro.pl.allegrosandbox.pl/auth/oauth/ The correct one is: https://allegro.pl.allegrosandbox.pl/auth/oauth/

tongalalal commented 1 month ago

@MaciejFrackowiak I used this real link and returned this data allegrosandbox.pl

Please enable JS and disable any ad blocker

res:<Response [403]> geteway:https://allegro.pl.allegrosandbox.pl/auth/oauth/, data:{"grant_type": "authorization_code", "code": "BYP2liKdwVDQN2yIVM02JcddFtMLmLLG", "redirect_uri": "my_redirect_uri"}, headers{"Authorization": "Basic ZTZlNTk3YmY1MjQyNDY0OGI4ZWEzMjZjYzg4YzdiNTg6NTZ1d0RqRzczWG16ZHQ5MEJpRGNUU2QwVU5ZcUU2b3lvazB1N0lSS0NpbHRiRjd0cHhwU2dFdlg0 VjAwb2Z4cQ==", "Content-Type": "application/x-www-form-urlencoded"}, the response code is 403, I don't understand what this means, but I still didn't get my access_token, what is the error

MaciejFrackowiak commented 1 month ago

As token URI, please use: https://allegro.pl/auth/oauth/token

tongalalal commented 1 month ago

@MaciejFrackowiak Is this not an official environment to get a token link, now I am using my sandbox account, I use this link, there will be an error {"error":"Unauthorized","error_description":"Unauthorized"} {"error":"Unauthorized","error_description":"Unauthorized"} res:<Response [401]> geteway:https://allegro.pl/auth/oauth/token, data:{"grant_type": "authorization_code", "code": "RZJfL1MKYlnJYciV4Rivh5X8Y86cMNDO", "redirect_uri": "redirect_uri"}, headers{"Authorization": "Basic ZTZlNTk3YmY1MjQyNDY0OGI4ZWEzMjZjYzg4YzdiNTg6NTZ1d0RqRzczWG16ZHQ5MEJpRGNUU2QwVU5ZcUU2b3lvazB1N0lSS0NpbHRiRjd0cHhwU2dFdlg0 VjAwb2Z4cQ==", "Content-Type": "application/x-www-form-urlencoded"}

MaciejFrackowiak commented 1 month ago

For Sandbox please use: https://allegro.pl.allegrosandbox.pl/auth/oauth/token

stale[bot] commented 3 weeks ago

W tym wątku nie pojawiła się żadna nowa odpowiedź w ciągu 7 dni, dlatego automatycznie oznaczamy go jako przeterminowany. Jeśli w ciągu kolejnych 7 dni nie pojawi się żadna odpowiedź, wątek zostanie zamknięty. Dziękujemy za zaangażowanie w dyskusję i zachęcamy Cię do wypełnienia ankiety dotyczącej naszego wsparcia na forum.


There was no new reply in this thread within 7 days, therefore, we automatically marked it as expired. If no response is received within the next 7 days, this thread will be closed. Thank you for engaging in the discussion. We encourage you to complete our forum support survey.