# Access token endpoint call fails with mod\_auth\_openidc

**URL:** <https://community.auth0.com/t/access-token-endpoint-call-fails-with-mod-auth-openidc/140307>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [August 2, 2024, 10:56am UTC](https://community.auth0.com/t/access-token-endpoint-call-fails-with-mod-auth-openidc/140307 "2024-08-02T10:56:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elster](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/elster/32/14596_2.png) [@elster](https://community.auth0.com/u/elster)\
**Post date:** [August 2, 2024, 10:56am UTC](https://community.auth0.com/t/access-token-endpoint-call-fails-with-mod-auth-openidc/140307/1 "2024-08-02T10:56:42Z")

</div>

I get the following error messages from the Apache mod\_auth\_openidc module when trying to get an access token after successful authorization during the authorization code grant flow:

```auto
[Fri Aug 02 09:19:55.682417 2024] [auth_openidc:debug] [pid 46548:tid 140693632694016] src/util.c(818): [client 10.143.241.138:25147] oidc_util_http_call: url=https://mysubtenant.mycompany.auth0app.com/oauth/token, data=grant_type=authorization_code&code=D_q7y3AniNUJ81bM4aSdbCIHSwN2OjLBSMLjJvmxspbkc&redirect_uri=https%3A%2F%2Fapache-linux-qa.mytest.mycompany.cloud%2FMyTestApp%2Fredirect_uri&client_id=MyClientID&client_secret=MyClientSecret, content_type=application/x-www-form-urlencoded, basic_auth=null, bearer_token=(null), ssl_validate_server=0, timeout=60, outgoing_proxy=(null), pass_cookies=0, ssl_cert=(null), ssl_key=(null), ssl_key_pwd=(null)
[Fri Aug 02 09:19:55.691199 2024] [auth_openidc:error] [pid 46548:tid 140693632694016] [client 10.143.241.138:25147] oidc_util_http_call: curl_easy_perform() failed on: https://mysubtenant.mycompany.auth0app.com/oauth/token ()
[Fri Aug 02 09:19:55.691259 2024] [auth_openidc:warn] [pid 46548:tid 140693632694016] [client 10.143.241.138:25147] oidc_proto_token_endpoint_request: error when calling the token endpoint (https://mysubtenant.mycompany.auth0app.com/oauth/token)

```

My Apache configuration looks like this:

```auto
OIDCProviderIssuer https://mysubtenant.mycompany.auth0app.com
OIDCProviderAuthorizationEndpoint https://mysubtenant.mycompany.auth0app.com/authorize?connection=main-tenant-oidc
OIDCProviderTokenEndpoint https://mysubtenant.mycompany.auth0app.com/oauth/token
OIDCProviderUserInfoEndpoint https://mysubtenant.mycompany.auth0app.com/userinfo
OIDCProviderTokenEndpointAuth client_secret_post
OIDCSSLValidateServer Off
OIDCOAuthSSLValidateServer Off
OIDCClientID MyClientID
OIDCClientSecret MyClientSecret
OIDCCookiePath /MyTestApp/
OIDCRedirectURI https://apache-linux-qa.mytest.mycompany.cloud/MyTestApp/redirect_uri
OIDCScope "openid email profile"
OIDCCryptoPassphrase "MyPassPhrase"

<Location /MyTestApp/>
   AuthType openid-connect
   Require valid-user
   LogLevel debug
</Location>

```

When I copy the authorization code along with the other parameters from the log file into a Bruno/Postman request, then I get a valid access token.

```auto
{
  "client_id": "MyClientID",
  "client_secret": "MyClientSecret",
  "redirect_uri": "https://apache-linux-qa.mytest.mycompany.cloud/MyTestApp/redirect_uri",
  "grant_type": "authorization_code",
  "code": "i8phLCzkZ7Sy7Q_PUm1EANRo1WI1Shnn8vdg0MQQXT2LF"
}

```

---

<div class="post-metadata">

**Author:** ![elster](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/elster/32/14596_2.png) [@elster](https://community.auth0.com/u/elster)\
**Post date:** [August 6, 2024, 10:03am UTC](https://community.auth0.com/t/access-token-endpoint-call-fails-with-mod-auth-openidc/140307/2 "2024-08-06T10:03:13Z")

</div>

Found the issue. A trailing slash was missing at the OIDCProviderIssuer. Replaced the OIDCProviderIssuer config param by the OIDCProviderMetadataURL config param.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 6, 2024, 7:23pm UTC](https://community.auth0.com/t/access-token-endpoint-call-fails-with-mod-auth-openidc/140307/3 "2024-08-06T19:23:28Z")

</div>

Awesome, glad you were able to get this sorted and thanks for sharing the solution 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 20, 2024, 7:23pm UTC](https://community.auth0.com/t/access-token-endpoint-call-fails-with-mod-auth-openidc/140307/4 "2024-08-20T19:23:38Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
