OAuth token request with basic authentication

I try the request token with basic authentication but receive an error: Unauthorized. I prepare the authenticated string in this way:

Basic encodebase64(<client_id>:<client_secret>)

Where is my mistake?

Hi @mitko.td,

Welcome to the Community!

Are you trying to implement the client credentials flow? This doc goes through implementation step-by-step:

Hi Dan,

Yes, when client_id and client_secret are URL parameters this works, but not in the situation which I described - Basic authentication.
This option exists in the discovery options which I received by “.well-known” request.

Hmm, I got it working using this:

Encode the client ID and secret:

echo -n 'YOUR_CLIENT_ID:YOUR_CLIENT_SECRET' | base64

Send the request:

curl --request POST \
     --url 'https://example_tenant.auth0.com/oauth/token' \
     --header 'Authorization: Basic BASE64_ENCODED_ID_AND_SECRET' \
     --data 'audience=YOUR_API_IDENTIFIER&grant_type=client_credentials'

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