missing required parameter: client_id - oauth-2.0

I tried to request a oauth token from hms server, but it always return missing required parameter: client_id to me.
url: https://oauth-login.cloud.huawei.com/oauth2/v3/token?grant_type=client_credentials&client_id=XXX&client_secret=XXX
header: Content-Type application/x-www-form-urlencoded
response:
{
"sub_error": 20001,
"error_description": "missing required parameter: client_id",
"error": 1102
}

This is because the params should be set in x-www-form-urlencoded.
url: https://oauth-login.cloud.huawei.com/oauth2/v3/token
header: Content-Type application/x-www-form-urlencoded
x-www-form-urlencoded:
grant_type client_credentials
client_id XX
client_secret XX

"sub_error": 20001,
"error_description": "missing required parameter: client_id",
"error": 1102
Based on the error information, and according to this Docs, It can be determined that the client_id field is empty or incorrect.
You could refer to this Docs to set.

Related

Twitter API Oauth2 issue getting Access Token

Following this guide: https://developer.twitter.com/en/docs/authentication/oauth-2-0/user-access-token. I am getting this error when making the POST oauth2/token at the step 3 request:
`
{
"errors": [
{
"code": 99,
"message": "Unable to verify your credentials",
"label": "authenticity_token_error"
}
]
}
`
This is my request: (Note that I hide the client_id and code). The code is the one I receive after the step 2, doing the GET oauth2/authorize callback. Header: Content-Type - application/x-www-form-urlencoded;charset=UTF-8
My Request
I found the issue, the problem was that in the Bot Application, editing the Auth settings of my twitter app, I had the option: Confidential client which needed a Basic Auth = authorization: Basic ${'username + password encoded here'}

Using microsoft calendar I'm trying to get access token using authorization code but every time get error message like “invalid_grant”

I tried get access token from microsoft example from here https://insen.github.io/blog/2017/09/24/Azure-AAD-with-Office-365/ No matter which property I use, I always get the 400 "invalid_grant" error. Anyone can help?
POST: "https://login.microsoftonline.com/[tenantId]/oauth2/token"
Content Type: "application/x-www-form-urlencoded"
Data:
client_id: [clientId]
scope: https://graph.microsoft.com/calendars.read
code: M.R3_BAY.6c27a84e-f211-c632-9298-c97ba411256b
redirect_uri: http://localhost/myapp/
grant_type: authorization_code
client_secret: [clientSecret]
Response:
{
"error": "invalid_grant",
"error_description": "AADSTS9002313: Invalid request. Request is malformed or
invalid.",
"error_codes": [
9002313
],
"timestamp": "2021-08-10 12:35:00Z",
"trace_id": "50ba80c2-7920-48bd-aee0-cab1b5baf801",
"correlation_id": "44fcb62f-b5f0-41f4-b596-b4abf74c2c55",
"error_uri": "https://login.microsoftonline.com/error?code=9002313"
}

Graph API authentication | The request body must contain the following parameter 'grant_type'

I'm trying to authenticate to Graph using Postman. I have the following request:
Type: Post
Url: https://login.microsoftonline.com/[MyTenantIdHere]/oauth2/v2.0/token
Body = Raw:
{
client_id: "[MyClientID]",
grant_type: "client_credentials",
scope: "https%3A%2F%2Fgraph.microsoft.com%2F.default",
client_secret: "[MyClientSecret"
}
However, I'm getting this error:
"error_description": "AADSTS900144: The request body must contain the
following parameter: 'grant_type'.
Any idea how to solve this?
Try X-www-form-urlencoded in postman.

OneDrive /me Error: InvalidAuthenticationToken

I am using the Code flow ... with scope of "onedrive.readonly onedrive.appfolder"
I get the code, then the token, and when I try to get the information about the user:
https://graph.microsoft.com/v1.0/me
In java I set the following headers to the request:
uc.setRequestProperty("Content-Type", "application/json");
uc.setRequestProperty("Authorization", String.format("Bearer %s", mSessionInfo.BearerToken));
I get the error:
{ "error": {
"code": "InvalidAuthenticationToken",
"message": "CompactToken parsing failed with error code: 8004920A",
"innerError": {
"request-id": "b8959569-efd0-4575-947e-c8835f8fef93",
"date": "2018-08-29T15:46:53"
} } }
What does this error mean ? How to proceed ?
The response actually indicates that the access token was not successfully generated or passed to the graph endpoint. Microsoft Graph couldn't parse it as a JWT token and thus attempted to process it as a Microsoft Account/Live Id compact token, which also failed. Please check the response that you got from the call to login.microsoftonline.com and that the token passed to graph.microsoft.com is a valid JWT token.

Is delegation deprecated in Auth0?

I'm trying to POST to a Auth0 delegation URL to obtain an access token and getting a "Grant Type not allowed" error as seen below. (This is when not using Postman.)
I came across a post in the forums that Delegation is deprecate in Auth0. Can anyone confirm if that is the issue here and if I'm trying something that's not available anymore?
Request:
Content-Type: 'application/json'
{
"client_id": "ID",
"grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
"id_token": "TOKEN",
"target": "lwTL1rYVfC0KsBUFPeKWY3HvGjbIgdDM",
"api_type": "salesforce_api",
"scope": "openid"
}
Error:
{
"error": "unauthorized_client",
"error_description": "Grant type 'http://auth0.com/oauth/legacy/grant-type/delegation/id_token' not allowed for the client.",
"statusCode": 403,
"error_uri": "https://auth0.com/docs/clients/client-grant-types"
}
Related Question:
"Missing grant-type parameter" in Auth0 Delegation endpoint call
In that question, using Postman to call the endpoint with the same request results in a different error!

Resources