allegro / allegro-api

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

Authentication for Allegro One Fulfillment Stock Level #10147

Open Thangthebrandlab opened 3 weeks ago

Thangthebrandlab commented 3 weeks ago

Hi,

I'm currently experiencing issues developing an API connection to retrieve One Fulfilment Stock Level, but keeps on experiencing 403 Forbidden error code.

For you context, I have already obtained an Rest API application:

Here is my sample code below:

import requests

url = "https://api.allegro.pl/fulfillment/stock"

payload = {}
headers = {
  'Accept': 'application/vnd.allegro.public.v1+json',
  'Accept-Language': 'en-US',
  'Authorization': '{Bearer Token goes here}',
  'Cookie': ''
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Where am I missing and what am I doing wrong? How can I retrieve One Fulfilment Stock Level? Thanks!

PrzemyslawLukanowski commented 3 weeks ago

Hi, only One Fulfillment type of accounts can access the One Fulfillment resources. To check whether yours is marked as 1F, use GET /me and check the information in the features field. If not, please use the contact form to get more information on how to register this type of account.

Thangthebrandlab commented 3 weeks ago

Hi, I also cannot access to the Get/me.

`import requests import json

url = "https://api.allegro.pl/me"

payload = {} headers = { 'Accept': 'application/vnd.allegro.public.v1+json', 'Content-Type': 'application/vnd.allegro.public.v1+json', 'Authorization': 'Bearer + {Token}', 'Cookie': '' }

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text) ` What have I perhaps done wrong here?

Error message 403 Forbidden: { "errors": [ { "code": "AccessDenied", "message": "Access is denied", "details": null, "path": null, "userMessage": "No access to the specified resource.", "metadata": {} } ] }

PrzemyslawLukanowski commented 3 weeks ago

It seems that you are using a token generated in the client credentials flow. That type of token does not have the user context and gives you access only to resources that are marked as bearer-token-for-application in our documentation. To have access to resources with bearer-token-for-user, please generate token via code or device flow.

stale[bot] commented 1 week 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.