I see this question same as this one you asked and I answered. Please check the linked question.
CORS issue while accesing and getting token for the application on application level and not logged in user?
I want to access organization user on the application level for users which are not logged in.
Below is the API I am hitting for same
https://login.microsoftonline.com/xxxxxxxxxxxxxxxxxxxxxxxx/oauth2/v2.0/token
I am getting the CORS error although i am allowing CORS
in the header.
Please find sample to access the token.
const requestHeaders: HeadersInit = new Headers();
requestHeaders.set('Content-Type', 'application/x-www-form-urlencoded');
requestHeaders.set('client_id','xxxxxxxxxxxxxxxxxxxxxxxx');
requestHeaders.set('scope',"https://graph.microsoft.com/.default");
requestHeaders.set('Access-Control-Allow-Origin',"*");
requestHeaders.set('client_secret','xxxxxxxxxxxxxxxxxxx');
requestHeaders.set('grant_type',"client_credentials");
Thanks
Sanjeev
1 answer
Sort by: Most helpful
-
Danstan Onyango 3,821 Reputation points Microsoft Employee
2021-04-13T17:07:07.777+00:00