Box returns 'Invalid grant_type parameter or parameter missing'
Invalid grant_type parameter or parameter missingShort answer
Box sends this invalid_request error when the token call cannot be read as a valid grant. Post to https://api.box.com/oauth2/token, not app.box.com or www.box.com. Send form-encoded grant_type with one of the documented values plus that grant's fields. Also check your app uses the matching auth method.
Fix it fast
1Find out which cause you have
Send the token request by hand to the API host. The response body names the error and its description.
curl -i -X POST https://api.box.com/oauth2/token \ -d grant_type=authorization_code \ -d code="$CODE" \ -d client_id="$BOX_CLIENT_ID" \ -d client_secret="$BOX_CLIENT_SECRET"2Match what you see, then jump to its fix
- 1
Invalid grant_type parameter or parameter missing, from a URL that is not api.box.comThe request goes to the wrong Box domainFix - 2
the same message and an HTTP 400grant_type is missing, misspelled or sent as JSONFix - 3
The grant type is unauthorized for this client_idThe grant type does not match how the app is configuredFix
- 1
What does the error look like?
Invalid grant_type parameter or parameter missingerror: invalid_requestThe grant type is unauthorized for this client_id
Cause 1 of 3
The request goes to the wrong Box domain
1Check
Box lists token requests sent to app.box.com or www.box.com as a cause of this message.
grep -rn "box.com/oauth2/token" .2Fix
Use https://api.box.com/oauth2/token for every token and refresh call. (app.box.com/api/oauth2/authorize is only the page where the user approves.)
POST https://api.box.com/oauth2/token
Content-Type: application/x-www-form-urlencoded3Verify
The response now returns a JSON access token or a different, more specific error.
curl -s -X POST https://api.box.com/oauth2/token -d grant_type=refresh_token -d refresh_token="$REFRESH" -d client_id="$BOX_CLIENT_ID" -d client_secret="$BOX_CLIENT_SECRET"Confirmed by developer.box.com
Cause 2 of 3
grant_type is missing, misspelled or sent as JSON
1Check
The token endpoint takes application/x-www-form-urlencoded, and grant_type is the one required field. Allowed values are authorization_code, refresh_token, client_credentials, urn:ietf:params:oauth:grant-type:jwt-bearer and urn:ietf:params:oauth:grant-type:token-exchange.
# log the raw body your HTTP client sends and check it starts with grant_type=...2Fix
Send form fields, not a JSON body. For the authorization code flow send grant_type=authorization_code with code, client_id and client_secret; for refresh send grant_type=refresh_token with refresh_token.
curl -X POST https://api.box.com/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d grant_type=refresh_token \
-d refresh_token="$REFRESH" \
-d client_id="$BOX_CLIENT_ID" \
-d client_secret="$BOX_CLIENT_SECRET"3Verify
HTTP 200 with access_token, expires_in and token_type in the body.
# check the JSON response contains access_tokenConfirmed by developer.box.com
Cause 3 of 3
The grant type does not match how the app is configured
1Check
Box documents this when the request type differs from the app's authentication method, for example a standard OAuth 2.0 request sent to an app set up for JWT. In the Developer Console, open the app's Configuration tab and read the Authentication Method.
# Developer Console > My Platform Apps > your app > Configuration2Fix
Use the grant that matches the method: authorization_code or refresh_token for OAuth 2.0, the jwt-bearer grant with an assertion for JWT, client_credentials for Client Credentials Grant.
# JWT app: grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
# plus client_id, client_secret and assertion3Verify
The token call returns an access_token.
# response status 200Confirmed by developer.box.com
How do I stop it coming back?
- Exchange the authorization code immediately; Box says it is valid for 30 seconds.
- Keep client_id and client_secret in environment variables, not in the repo.
- Log the Box error and error_description fields, not just the HTTP status.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Related fixes
Security
Entra ID token request fails: the request body must contain the parameter 'grant_type'
AADSTS900144: The request body must contain the following parameter: 'grant_type'.
The token endpoint did not find grant_type in the form body of your POST.
3 causes, each with a fixSecurity
Angular HttpClient does not add the X-XSRF-TOKEN header to a request
403 Forbidden on POST, PUT or DELETE while GET works
Angular copies the XSRF-TOKEN cookie into an X-XSRF-TOKEN header only for mutating requests to the same origin, and only when the cookie is readable by script.
5 causes, each with a fixSecurity
An [Authorize] endpoint rejects a request with a bearer token
Authorization Header sent: no Bearer token sent.
An [Authorize] endpoint without a policy name requires an authenticated user.
4 causes, each with a fixSecurity
ASP.NET Core API rejects an Angular user's token: the signature key was not found
401 Unauthorized
The API looked for the key named by the token's kid in the key set it downloaded from your Authority, and the key was not there.
4 causes, each with a fixSecurity
ASP.NET Core rejects the token before checking it: IDX12741, three segments expected
401 Unauthorized
IDX12741 means the string the API pulled out of the Authorization header is not shaped like a JWT: a signed token has three dot-separated parts and an encrypted one has five.
3 causes, each with a fixSecurity
A Microsoft Entra access token shows Invalid Signature when you check it yourself
Tokens that a Microsoft API receives might not always be a JWT that can be decoded
A token issued for Microsoft Graph is not meant for you to validate, so a failed signature check is expected.
2 causes, each with a fix