I am using Azure AD and have to call an API to get access token to start a pipeline.
I am using OAuth2 for authorization but don't know the right way to do that.
I tried it using Postman and was able to get reponse successfully.
but when I tried the same using Angular n Node.
In Angular I got CORS error and In Node I got a status code of 401 in message
I have endpoint URL which i'm using to get token from Azure AD which i have test on Postman something like this.
https://login.microsoftonline.com/{SomeID}/oauth2/token
request headers:
Content-Type: application/x-www-form-urlencoded
request body:
grant_type: client_credentials
client_id: {Client_ID}
client_secret: {Secret}
resource: https://management.azure.com
For node i used third-party package name AXIOS
I feel it is not right to pass the request from Angular itself so send the request from backend only make sense.
Please Help me I am stuck from 2 weeks reading documentation but not getting anywhere.
A code would be of great help.
@azure/msal-angular
to implement Azure AD auth. After doing that, you can avoid the CORS issue. For more details about how to implement, please refer to the sample : docs.microsoft.com/en-us/samples/azure-samples/… – Jim Xu