I was trying to fetch access token where vault is configured as OIDC Provider.
I followed the steps from – https://developer.hashicorp.com/vault/tutorials/auth-methods/oidc-identity-provider#create-a-vault-oidc-provider
When I hit the token end point, I’m getting the below error
BASIC_AUTH_CREDS=$(printf "%s:%s" "$CLIENT_ID" "$CLIENT_SECRET" | base64)
curl
--request POST
--header "Authorization: Basic $BASIC_AUTH_CREDS"
-H 'Content-Type: application/x-www-form-urlencoded'
-d "code=8oeahsnfHI9XYBw7yTrY2fIc9bUMNUwd"
-d "grant_type=authorization_code"
--data-urlencode "scope=openid"
-d "redirect_uri=http://127.0.0.1:9200/v1/auth-methods/oidc:authenticate:callback"
https://127.0.0.1:8200/v1/identity/oidc/provider/my-provider/token
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
We need to disable line wrap in the base64 string.
BASIC_AUTH_CREDS=$(printf "%s:%s" "$CLIENT_ID" "$CLIENT_SECRET" | base64 -w 0)
curl
--request POST
--header "Authorization: Basic $BASIC_AUTH_CREDS"
-H 'Content-Type: application/x-www-form-urlencoded'
-d "code=8oeahsnfHI9XYBw7yTrY2fIc9bUMNUwd"
-d "grant_type=authorization_code"
--data-urlencode "scope=openid"
-d "redirect_uri=http://127.0.0.1:9200/v1/auth-methods/oidc:authenticate:callback"
https://127.0.0.1:8200/v1/identity/oidc/provider/my-provider/token
{"access_token":"hvb.AAAAAQJ402rvbPj6pJSqd2x7bm2oe1O7Ltb6Xq-CrnbMyOlL4FJRx.....}