i try to ad a custom App witch gives the ability to add a event to my Outlook Calendar, only for me.
It seems that it works to connect to MS, Authorization works, but when i try to send a request i get
"AADSTS900144: The request body must contain the following parameter: ‘refresh_token’
“refresh_token” is not set in the request body. It seems that the token is set in the Request Header behind tokens:
there is the access token set and the refresh token with no value.
I use the example from the documentation. The client secret etc… is already setup and i using client.request method.
Can you please ensure isOAuth: true option is set in client.request options and have Authorization header { Authorization: “bearer <%= access_token %>”}. You can find the example in OAuth. I had copied the same here.
XHRPOSThttps://marketplace-euc.freshworks.com/platform
[HTTP/1.1 400 Bad Request 664ms]
action "refresh"
data {…}
headers {…}
Authorization "bearer <%= access_token %>"
isOAuth true
method "get"
url "https://outlook.office.com/api/v2.0/me/calendars"
tokens {…}
access_token "…01b4727909218a5cd88c35 some more "
refresh_token ""
The console Output is:
response "{\"error\":\"invalid_request\",\"error_description\":\"AADSTS900144: The request body must contain the following parameter: 'refresh_token'.\\r\\nTrace ID: fa137ca3-4a80-4805-8e2a-08f052470000\\r\\nCorrelation ID: d452810f-d002-414f-96b9-36c77a5e4974\\r\\nTimestamp: 2021-03-13 07:55:09Z\",\"error_codes\":[900144],\"timestamp\":\"2021-03-13 07:55:09Z\",\"trace_id\":\"fa137ca3-4a80-4805-8e2a-08f052470000\",\"correlation_id\":\"d452810f-d002-414f-96b9-36c77a5e4974\",\"error_uri\":\"https://login.microsoftonline.com/error?code=900144\"}"
If the OAuth is performed in local simulation using Freshworks CLI, you’d notice a .localstore inside of .fdk/ directory. Do you see the refresh_token obtained before client.request.get(..) sends the request?
i’m not able to test this localy, because on local testing MS sends:
´´´
AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: ‘a6acbf7a-3929-4227-bfd1-4c6f9fcfb133’.
´´´
Dont know why but, redirect URLs are set like described.
But i uploaded a custom app for testing. Auth to MS seems to work, only the refresh_token in first post is not set.
The localstorage from the custom app, show me a key, app_378…, with token: and a set access_token, and refresh_token with empty value.
Can you please add the entire redirect url including the query parameters in the MS dashboard where you already gave the redirect URL. I guess this issue is similar to
@ManiDeepak_Vandrangi
i add the redirect url as given, but for MS i must URI encode the query params. But still dont working locally. Same error like before:
´´´
AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: ‘a6acbf7a-3929-4227-bfd1-xxxxxxxxxxxx’.
´´´
so i find my solution for the refresh_token. It is like @sarfaraz_Mohammed mentioned.
I totally missed the offline_access both in scopes and in the AAD.