# Authentication Error - The endpoint does not support the provided HTTP method

**URL:** <https://devforum.okta.com/t/authentication-error-the-endpoint-does-not-support-the-provided-http-method/21684>\
**Category:** OAuth/OIDC\
**Created:** [August 26, 2022, 1:44pm UTC](https://devforum.okta.com/t/authentication-error-the-endpoint-does-not-support-the-provided-http-method/21684 "2022-08-26T13:44:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![denis.futida](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@denis.futida](https://devforum.okta.com/u/denis.futida)\
**Post date:** [August 26, 2022, 1:44pm UTC](https://devforum.okta.com/t/authentication-error-the-endpoint-does-not-support-the-provided-http-method/21684/1 "2022-08-26T13:44:56Z")

</div>

Hello everybody,

I’m implementing authentication in Okta and the login page loads normally. But I have some errors.

This is the URL for the login page:

[https://dev-13205505.okta.com/oauth2/default/v1/authorize?redirect\_uri=https://cmsdev.br.ibm.com/public/index.php/authorization-code/callback&response\_type=code&client\_id=0oa67z8u1oMlVbPxV5d7&state=738a8d7502844478a12e&code\_challenge=iMCW7OGCd6CmBe3xDLJTUrhYWq5E8J45hi-uz1JWwVc&code\_challenge\_method=S256&nonce=nonce&scope=openid+profile+email](https://dev-13205505.okta.com/oauth2/default/v1/authorize?redirect_uri=https://cmsdev.br.ibm.com/public/index.php/authorization-code/callback&response_type=code&client_id=0oa67z8u1oMlVbPxV5d7&state=738a8d7502844478a12e&code_challenge=iMCW7OGCd6CmBe3xDLJTUrhYWq5E8J45hi-uz1JWwVc&code_challenge_method=S256&nonce=nonce&scope=openid+profile+email)

 ![image](https://global.discourse-cdn.com/oktadev/original/2X/e/e79fd4d4e41164bf104153ea192067a1e491937f.png)

When I enter username and password, the error message returns:

This is the authenticated URL in Okta:

[https://cmsdev.br.ibm.com/public/index.php/authorization-code/callback?code=4\_kiSXI5lqyTgK-sslCo8Q137Q7zutj9z0JPvG8eXHM&state=738a8d7502844478a12e](https://cmsdev.br.ibm.com/public/index.php/authorization-code/callback?code=4_kiSXI5lqyTgK-sslCo8Q137Q7zutj9z0JPvG8eXHM&state=738a8d7502844478a12e)

When accessing the URL the error message appears

// [https://dev-13205505.okta.com/oauth2/default/v1/token](https://dev-13205505.okta.com/oauth2/default/v1/token)  
{  
“errorCode”: “E0000022”,  
“errorSummary”: “The endpoint does not support the provided HTTP method”,  
“errorLink”: “E0000022”,  
“errorId”: “oaebDnffe31Qny6hmRCJKUnNQ”,  
“errorCauses”: [  
]  
}

Can anyone help?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [August 26, 2022, 9:04pm UTC](https://devforum.okta.com/t/authentication-error-the-endpoint-does-not-support-the-provided-http-method/21684/2 "2022-08-26T21:04:07Z")

</div>

Are you trying to make a POST to the /token endpoint to exchange the authorization code (`code` URL param) sent back from Okta to the `redirect_uri`?

---

<div class="post-metadata">

**Author:** ![denis.futida](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@denis.futida](https://devforum.okta.com/u/denis.futida)\
**Post date:** [August 26, 2022, 9:12pm UTC](https://devforum.okta.com/t/authentication-error-the-endpoint-does-not-support-the-provided-http-method/21684/3 "2022-08-26T21:12:42Z")

</div>

Hello @andrea ,

I’m trying to set the CURL return session, but I found that you don’t have CURL installed on the server, maybe that’s why the code is giving error.

$token\_endpoint = $\_ENV[‘OKTA\_OAUTH2\_ISSUER’].‘/v1/token’;

$ch = curl\_init($token\_endpoint);

curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);  
curl\_setopt($ch, CURLOPT\_POSTFIELDS, http\_build\_query([  
‘grant\_type’ =\> ‘authorization\_code’,  
‘code’ =\> $\_GET[‘code’],  
‘code\_verifier’ =\> $\_SESSION[‘oauth\_code\_verifier’],  
‘redirect\_uri’ =\> $\_ENV[‘OKTA\_OAUTH2\_REDIRECT\_URI’],  
‘client\_id’ =\> $\_ENV[‘OKTA\_OAUTH2\_CLIENT\_ID’],  
‘client\_secret’ =\> $\_ENV[‘OKTA\_OAUTH2\_CLIENT\_SECRET’],  
]));

$response = json\_decode(curl\_exec($ch), true);

$\_SESSION[‘okta\_id\_token’] = $response[‘id\_token’];

Does not run CURL.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 12, 2024, 9:56pm UTC](https://devforum.okta.com/t/authentication-error-the-endpoint-does-not-support-the-provided-http-method/21684/4 "2024-02-12T21:56:50Z")

</div>


