Hi, I’ve been stuck for a long time trying to use the oauth2-user-agent-flow from the API-CONNECTOR plugin.
The documentation is not good and leaves many gaps open.
Just to clarify, I know the entire user authentication flow using oauth2. So that’s not a problem for me.
Before using the plugin, I performed the entire authentication flow through the bubble with api-connector and command line and everything worked fine to retrieve the token.
I’m using Auth0 identity provider. Soon:
-
I have successfully set up my account on oauth0
-
I have successfully configured the api-connector plugin
-
I was able to authenticate myself by being redirected to the auth0 page successfully
-
I was redirected to the app with the code successfully
-
As I understand it, the api-connector plugin should get the code and fetch the token in the same way as we do via the command line, as all the information needed to make the request is configured in the plugin. Below is an example I made via the command line to retrieve my token after authentication
curl --request POST \ --url 'https://dev-1d3mpc3w.us.auth0.com/oauth/token' \ --header 'content-type: application/x-www-form-urlencoded' \ --data grant_type=authorization_code \ --data 'client_id=XXX' \ --data client_secret=XXX \ --data code=RECEIVED_CODE_FROM_CALLBACK_URL \ --data 'redirect_uri=https://MY_APP.bubbleapps.io/version-test'
The response of this request returns me a JSON like below:
{
"access_token":"eyJhbGciO...",
"refresh_token":"v1.Md2-...",
"id_token":"eyJhbGciOiJSUzIoczBYaTlHcWFrX0FpQ1lBcyJ9...",
"scope":"openid profile email offline_access",
"expires_in":86400,
"token_type":"Bearer"
}
The id_token
is what I need to send to my api as Authorization header: Bearer ID_TOKEN_HERE
,
Problems start from that point
- The plugin does not create the token by calling again on the configured endpoint
http://dev-1d3mpc3w.us.auth0.com/oauth/token
- Authenticated calls do not work as the token is not captured and is not sent
I’ve tried to make several changes to the plugin’s settings and have had no success.
- I followed many official bubble tutorials including this one which is one of the best for me
https://www.youtube.com/watch?v=DXsL4FjAhd8&t=1300s&ab_channel=Bubble - I read the documentation but unfortunately the plugin documentation is not good and doesn’t explain everything that needs to be done.
Understand How Metadata Works in User Profiles - Here is an easter egg that is not commented out in the plugin documentation
Dynamic Token In API Connector Authorization Header - #2 by robertpbrinton - Here is also something very similar to what I need but it didn’t work for me either
https://docs.airdev.co/functionality-reference/resources/auth0 - Here is the demo plugin that I also tried to understand
https://plugin-auth0-demo.bubbleapps.io/