The endpoint does not support the provided HTTP method

curl -v -X POST -H “Content-type:application/x-www-form-urlencoded” "https://dev-977966.okta.com/oauth2/default/v1/token” "client_id=0oa12q40pQWdEa9BX4x6&client_secret=5epLPZHmXamAc_znFgmkSGa1KAaORD2nU9hqwUYR&grant_type=authorization_code&redirect_uri=http://localhost:8080/content-catalog/login&code=l4pfjvskiaogqrjh0mje”.
This is the url I am trying to hit.But constantly getting the error :{“errorCode”:“E0000022”,“errorSummary”:“The endpoint does not support the provided HTTP method”,“errorLink”:“E0000022”,“errorId”:“oaeQcGqhUcWT7asditRk6CDNw”,“errorCauses”:[]}.

Can anyone help me with this?

Do you specify an authorization header?

Can you try formatting your curl request like this (from this guide):

curl --request POST \
  --url https://${yourOktaDomain}/oauth2/default/v1/token \
  --header 'accept: application/json' \
  --header 'authorization: Basic MG9hY...' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'grant_type=authorization_code&redirect_uri=http%3A%2F%2Flocalhost%3A8080&code=P59yPm1_X1gxtdEOEZjn'
1 Like

Ummm.No .I dont.Do I need to do that?what is can you share the format?

I have now added the authirisation header.
I had to convert the client id and secret into base64 .Following is the new request-

curl --location --request POST ‘https://dev-977966.okta.com/oauth2/default/v1/token
–header ‘Accept: application/json’
–header ‘Content-type: application/x-www-form-urlencoded’
–header ‘Authorization: Basic ********************’
–data-urlencode ‘grant_type=authorization_code’
–data-urlencode ‘redirect_uri=http://localhost:8080/content-catalog/login’
–data-urlencode ‘code=jmnfp2shpipnplzexbur’.

But ,now the error is {
“error”: “invalid_grant”,
“error_description”: “The authorization code is invalid or has expired.”
}.
The code is new (<60 seconds) and not even logged(definitely not used) into the developer.okta.com portal.
Why is it invalid then?

Can you ensure that you’re using the same Authorization Server and clientId in your /authorize request, with the URL looking like this: https://dev-977966.okta.com/oauth2/default/v1/authorize

Also, keep in mind that you can only use the code once, so any subsequent calls to the /token endpoint with the same code will result in an error

I got the same issue.
Here is my cURL script
curl --request POST ^–url “https://dev-899154.okta.com/oauth2/default/v1/token”^–header “Accept: application/json”^–header “Content-type: application/x-www-form-urlencoded”^
–header “Authorization: Basic **********************”^–data-urlencode “grant_type=authorization_code”^–data-urlencode “redirect_uri=https://wsq02230.xxx.xxxx.xxx/xxxxx/OkTaIntegrationCFTest/openid/callback.cfm”^–data-urlencode “code=9bWPbSjWfV5VEuc__Oix”

Dear Okta,

Could somebody explain us what is a problem with OKTA on AWS.
I sow a lot of questions about the same problem on Okta forum, but nobody give the answer for the problem?
I have next problem: When I am using localhost, everything work well, and I can sing-in and sign-out using Okta. When I deploy the application on the AWS (I changed Sign-in redirect URIs and Sign-out redirect URI, to be like it is for deployed application on AWS (for frontend I am using Angular)). However, I can not sing-in on deployed AWS applcation. I can see in response:
_links: {cancel: {href: “https://dev-xxxxxxx.okta.com/api/v1/authn/cancel”, hints: {allow: [“POST”]}}}

cancel: {href: “https://dev-xxxxxxx.okta.com/api/v1/authn/cancel”, hints: {allow: [“POST”]}}

hints: {allow: ["POST"]}

  allow: ["POST"]

    0: "POST"

  href: "https://dev-xxxxxxx.okta.com/api/v1/authn/cancel"

When I go to the: https://dev-xxxxxxx.okta.com/api/v1/authn/cancel ,
I can see the response:
{
“errorCode”: “E0000022”,
“errorSummary”: “The endpoint does not support the provided HTTP method”,
“errorLink”: “E0000022”,
“errorId”: “XXXXXXXXXXXXXXXXXXX”,
“errorCauses”:
}

Could somebody from Okta give us the response and solution for the problem Sign-in, Sign-Out Okta on AWS ?

Here is an article that may help!