GET Shift Preference Issue

66 views Asked by At

Having an error when getting this API (https://learn.microsoft.com/en-us/graph/api/shiftpreferences-get?view=graph-rest-1.0&tabs=http)

Request header:

{'Authorization': 'Bearer eyJ**6MA', 'Content-Type': 'application/json', 'MS-APP-ACTS-AS': '53**76'}

Error Response: {'error': {'code': 'Forbidden', 'message': '{"error":{"code":"Forbidden","message":"The user identifier in the path does not match the one in the authorization token.","details":[],"innererror":{"code":"InvalidOAuthToken"}}}', 'innerError': {'date': '2020-10-06T13:53:08', 'request-id': '093**ad', 'client-request-id': '09**bad'}}}

And I have all permissions required for this.

Any Idea why is this?

1

There are 1 answers

1
Carl Zhao On BEST ANSWER

I can easily reproduce your problem.

enter image description here

This error will occur if you use the wrong user_id or the token you use is not issued by the user. You can use https://jwt.ms/ to parse your access token and view oid Claims, which is your user_id and also Token issuer, you need to ensure that it is consistent with the user_id in your request path.

enter image description here

enter image description here

There is also a relatively simple method, you can directly use Graph Explorer to request this API (this requires you to log in).

enter image description here