Login with Oauth2 (Wordpress)

Hey guys,
I’m still new to using APIs in bubble. I’d like my app to have the following ability:

I tested my Oauth2 server, Using Postman, i get an 200 OK reponse for: url.com/oauth/token.

I entered the following data in the API plugin:

Then i made a page with a simple button and the following workflow:

and this is what i get when clicking the button on the browser…

Someone can suggest how i can approach this problem? i don’t want users to be able to register in bubble, only from wordpress.


Using Postman and Insomnia, i managed to get a token from my oauth server, but i have no idea what to do with it. I’m pretty sure the only problem is that i don’t configure it properly in bubble.

Using the Oauth user-flow agent:

i set up a login button with a workflow to login through said oauth2, give me this:

Here is a working protocol from Postman, in order for it to work, i have to send a password and a username with the body, which i can’t do right now in bubble:

I’m so close but so far away, lol

1 Like

Did you follow the instructions in the “Warning, you haven’t tested this API in run mode…” section?

i didnt’t notice that… thanks for letting me know. :sweat_smile:

I’ve just tried it, and it still didn’t work - i got the same error message (it seems as the app runs with ?debug_mode=true at the end of the url by default anyways)

I’ve checked out your screenshot.
Your API request from the screenshot is not for authentication. “OAuth2 User-Agent Flow”.

Thanks for looking at it.
What should it be then? i thought it should be a User-Agent flow so that the user can login at the URL endpoint.

OAuth2 User-Agent Flow
The scope of it is to redirect a user to url from “Login dialog redirect” where he will be able to enter his credentials. On success, the user will be redirected back with a “code” parameter in url that will be used for the “Access token endpoint”. Also, it’s required to have an endpoint for “User profile endpoint” that will retrieve info (id and email) about the authenticated user from your WordPress site.
In additional, you need an API Endpoint that will refresh a user’s access token.

1 Like

Yes, this is exactly what i’m trying to do.
I have all of the required endpoints, and using Postman, i manage to get an access_token, but not in bubble.

Try the following:

  1. Remove those shared client id and client secret parameters. Those values should probably only go up at the top in App ID (client id) and App Secret (client secret)

  2. Check “Authentication goes in the header” and change the Token name to “Authorization: Bearer” … I can see in your postman response that the token type is “bearer” which is why I suggest this

See if that gets you any new results when you run your app with debug mode and click on signup/login with your API. Seeing as you have a username/password situation with Postman, it seems like the access token may be using Basic Auth, so you might also need to check that box at the top.

Thank you for your help Gaby :slight_smile:
Unfortunately, i keep getting the error:

API Connector error: the Oauth2 API Wordpress Oauth is not configured properly - missing access_token getting data Oauth2

Is there any way i can re-create your plugin to login to my WP server?

Hey @Bubbler, Is there any luck with the implementation. I’m looking to do the same exact implementation.

Anyone figure this out ?

wordpress.com api settings, working:

1 Like

Hi Bubbler, did you finally find a solution? I am in the same situation as you…