azurepostmanmicrosoft-fabric

Getting error while creating access token using OAuth 2.0 for MS Fabric


In Postman I am trying to generate Access token using Oauth2.0 for MS fabric Update API call.

I have entered below details

POST https://login.microsoftonline.com/tenant-ID/oauth2/v2.0/token

Under Authorization: I selected Oauth2.0

Configure New Token Token Name: test

Grant type: Authorization Code

Callback URL: http://localhost

Auth URL: https://login.microsoftonline.com/Tenant-ID/oauth2/v2.0/authorize

Access Token URL: https://login.microsoftonline.com/Tenant-ID/oauth2/v2.0/token

Client ID: *** Client Secret: *** Scope: https://api.fabric.microsoft.com/.default

Refresh Token URL https://login.microsoftonline.com/Tenant-ID/oauth2/v2.0/token

In Azure AD App Registration I have set- Web Redirect URI: http://localhost

When I click "Get New Access Token" I get error as below

"error": "invalid_request", "error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'. Trace ID: ** Correlation ID: ** Timestamp: 2025-02-19 07:33:46Z", "error_codes": [ 900144 ], "error_uri": "https://login.microsoftonline.com/error?code=900144" }

GET https://login.microsoftonline.com/**/oauth2/v2.0/authorize?response_type=code&client_id=3**ac&scope=https%3A%2F%2Fapi.fabric.microsoft.com%2F.default&redirect_uri=http%3A%2F%2Flocalhost 302 POST https://login.microsoftonline.com/**/oauth2/v2.0/token%0A 400 559 ms Error: Could not complete OAuth 2.0 token request

Screenshot enter image description here


Solution

  • I am using Postman web version to generate the access token

    Created a Microsoft Entra ID application and configured redirect URI as WEB:

    enter image description here

    As I am using Postman web version, I configured redirect URI as https://oauth.pstmn.io/v1/browser-callback. If you are making use of Postman app then configure it as https://oauth.pstmn.io/v1/callback

    Now I generated the tokens, selecting OAuth 2.0 under Authorization:

    Token Name: test
    Grant type : Authorization Code
    
    Callback URL : RedirectURL
    Auth URL : https://login.microsoftonline.com/TenantID/oauth2/v2.0/authorize
    Access Token URL : https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
    ClientID : ClientID
    Client Secret : ***
    Scope : https://api.fabric.microsoft.com/.default openid offline_access
    
    Refresh Token URL : https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
    

    enter image description here When I clicked on Get New Access Token, I got the sign-in screen:

    enter image description here

    I got tokens successfully:

    enter image description here

    enter image description here

    enter image description here

    In the screenshot you have added, I can see you have pasted the token URL in the POST. Try to remove and check.

    If still the issue persists, open a new request and configure the new token request.