OAuth2.0 does not work

1) My goal: I'm building a dashboard that requires user authentication. I've created an auth resource and connected it to an auth login component. According to forum posts, Retool doesn't have a native way to trigger a query after a successful (or unsuccessful) login attempt. To work around this, I created a separate query that attempts to retrieve information from our API - if the login was successful, this query succeeds; if not, it returns an error. I'm using this approach to determine what happens next in the system.

2) Issue: I've tried everything but I cannot figure out how to pass the OAUTH2_TOKEN to my query, so it always fails, and the user can never access the dashboart. I need help understanding how to properly pass the authentication token from the login component to my subsequent API query.

3) Steps I've taken to troubleshoot: Did 2 auth resourses with 2 different querys

4) Additional info:
First approach:
Auth resourse



Query to manage workarround (and its error)

Second approach:
same but with custom auth and custom variables

The query requires authorization since it's triggered after login. I've verified that the token is generated correctly in the backend. However, I believe the issue is that the token isn't being properly passed to the query, causing it to fail despite successful authentication.

Any help with this issue would be tremendously appreciated. Thank you in advance!

@Andres_Dalla_Rizza,
I can try to help you. Let me see if I have this correctly. You have created an OAuth resource, and are using the Auth Login component to login to it. After that flow is complete, you are trying to query that same resource and it is not working for you? Theoretically you should not need to pass in a token into the resource query because Retool should be doing that automatically for you.
Can you remove the Authorization Header in your query and see if this works after you login to your resource?

Thank you for your response.
I removed the token from te query:


My AA2 resource:

And still get the same error after the log in (the error comes from the query that runs every time that the page renders)

@Andres_Dalla_Rizza,
Can you show me a screenshot of your custom auth for your resource?
Also, can you please send me the json file that you can export from your app?

Thanks!

Thank you for answering so fast! Of course!!

FightFi.json (291.2 KB)

What happens when you click your Connect with OAuth button on your config?
Also, what happens when you UNCLICK Share credentials between users?

Finally, you might try setting up an auth verification endpoint by checking the Enable an auth verification endpoint using the instructions here.