Home  >  Q&A  >  body text

grant_type parameter missing in Postman

I'm using the Brightspace API.

I am using the post method, the URL is https://auth.brightspace.com/core/connect/token

Reference link here

I have all the details below

Auth URL,
Access Token URL,
Client Id,
Client Secret,
Scope,

The Grant type is , and I chose the Authorization Code option.

In the header, Content-Type is also application/json

Now when I click the send button I get the error

{
    "error": "invalid_request",
    "error_description": "Missing \"grant_type\" parameter"
}

Any idea where I'm getting this error?

P粉639667504P粉639667504268 days ago479

reply all(1)I'll reply

  • P粉360266095

    P粉3602660952024-02-18 09:46:34

    You cannot directly call the POST method of response type "Code" Since after the POST call, Keycloak (IdP server) redirects to the registered URL (redirect_uri) for the login activity. Fortunately, In the Postman can do this via Get New Token in OAuto 2.0 mode.

    I don't have the client ID/secret for my D2L Brightspace account so I can't demonstrate how to do it, but I captured the image from the video tutorial.

    You can do this using your client ID/secret. step

    1. Set environment variables in Postman (click the icon in the upper right corner) clientid, clientsecret and your values ​​and oauth2scope(content:.)

    2. Start "Get New Token" Select the "Authorization" tab, select the "OAuth 2.0" type, "Request Headers" and click "Get new access token" in the request (can also be in the collection)

    3. Set the fields of each parameter

    Enter 3 URLs from 1~3

    Enter 3 environment variables from 4~6, where {{ variable name }}

    Click "Request Token" and it will get the access token. More details in here, Video and Postman Collection

    reply
    0
  • Cancelreply