-
Goal: Create a new GraphQL resource using Auth0 Client Credentials Flow for a new API we've created
-
Steps:
- Created a new "API" in Auth0 for our new GraphQL API
- Granted access to the API to our "Retool" client "Application" in Auth0
- Created a new GraphQL Resource in Retool.
- Entered the new API URL
- Selected "Auth0 Client Credentials" as the authentication mechanism for the API
- Entered the Client ID, Client Secret, and Audience from Auth0 to authenticate the Retool application for the new API audience.
- Click "Test Connection".
- See connection failed errors.
When I debug the request, I see that Retool is properly setting an Authorization header on the request, but it says "------ sanitized ------ " in the console. Fair enough. So I added temporary logging while we set this up to our API to log out the headers. The log says: Authorization: Bearer undefined
as the header. If I go back and remove the Auth0 Client Credentials authentication mechanism from the resource and manually input a JWT generated from Auth0 for that App/API combo into the Authentication header for the resource everything works fine and the proper token is logged out in my app.
-
Details:
I've tried a lot of things to debug this. I've created a new Application in Auth0 just for this API, that didn't work. I've duplicated an existing Resource that should have the exact same configuration as this Resource with the exception of the Base URL and audience. That didn't work, but it didn't work in a different way, it was sending an Auth0 JWT token to my API, but it was a cached one from the original resource! It had the wrong audience so my API won't accept it. -
Screenshots: Unfortunately due to the sensitive nature of this kind of configuration I don't feel like publicly sharing any screenshots.