400 (Bad Request) when requesting OAuth2 access token to login

Discussão em 'Angular' iniciado por Jonathan Santos, Novembro 5, 2024.

  1. I am developing an application using Angular. This application needs to consume an API on Microsoft through the URL: https://login.microsoftonline.com/{tenant}/oauth2/token

    This API returns a token that will be used in other requests from the application. I have already made the configurations and releases that I believed were necessary for this access, such as creating the client_id, client_secret, etc.

    Given this, I have the following situations:

    When I execute the request via Postman or via Node (running only a .js file for testing) the return is 200, that is, it returns the information with the token. When I execute the request through the application removing the browser security in development mode for testing (i.e. chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security) the server returns 200 also with the token information. When I run the application using normal browser access, I get a 400 (Bad Request) error.

    With that, I'm not sure if I have a problem with the Angular application or a problem with the release or configuration of the client_id.

    Has anyone ever had to perform this authentication? Or, do you have any idea how I could solve this problem?

    I didn't find anything specifically about this URL and I followed several tips for configuring the client_id but nothing worked.

    I am at your disposal if you need any further information.

    Continue reading...

Compartilhe esta Página