Description
Description
I believe the upgrade to 1.0.0 and the change from github.com/dgrijalva/jwt-go to github.com/form3tech-oss/jwt-go broke using Auth0's Client Credentials. We currently use this to do integration tests. The types have changed for StandardClaims for the audience field, going from string
to []string
, which makes the Bearer token returned from /oauth/token
endpoint not useable.
Reproduction
curl --request POST \
--url https://<<your app>>.auth0.com/oauth/token \
--header 'content-type: application/json' \
--data '{"client_id":"<<YOUR ID>>","client_secret":"<<YOUR SECRET>>","audience":"https://<<your app>>.auth0.com/api/","grant_type":"client_credentials"}'
Passing that credential into the go-jwt-middleware library results in the error JWT Check failed. Error: Error parsing token: json: cannot unmarshal string into Go struct field CustomClaims.aud of type []string
.
If I try to make the same call with multiple audiences or a single audience with an array "audience":["https://<>.auth0.com/api/"]) the curl call fails.
{"error":"invalid_request","error_description":"Invalid audience. Expected type 'string' but found type 'object'."}%
I also tried escaping ("audience":\["https://<<your app>>.auth0.com/api/"\])
, but I get an invalid json
error.
Environment
Please provide the following:
- Version of this library used: 1.0.0
- Version of the platform or framework used, if applicable: N/A
- Other relevant versions (language, server software, OS, browser): N/A
- Other modules/plugins/libraries that might be involved: github.com/form3tech-oss/jwt-go