Curl Authentication Code Client Secret and Client ID

Viewed 1929

When using a curl request for authentication, I have all the required information such as client ID, client secret, URL and authorization code, but it seems that everytime I send a request I never get the expected result.

curl -X POST 'https://identity.moneyhub.co.uk/oidc/token' \
  -H 'Authorization: Basic Base64_encode(<client_id>:<client_secret>)'\
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=authorization_code&code=example-auth-code&redirect_uri=example-redirect-uri&sub=example-user-id'
2 Answers
curl -X POST 'https://identity.moneyhub.co.uk/oidc/token' 
-H 'Authorization: Basic Base64_encode(<client_id>:<client_secret>)'

Add -u instead of -H:

-u 'Authorization: Basic Base64_encode…
curl  -X POST https://identity.moneyhub.co.uk/oidc/token
-u <YOUR_KEY_ID>:<YOUR_SECRET>
-H 'Content-Type: application/x-www-form-urlencoded' 
-d 'grant_type=authorization_code&code=example-auth-code&redirect_uri=example-redirect-uri&sub=example-user-id'
Related