LinkedIn Oauth - Invalid state from oauth provider

I am trying to implement the LinkedIn oauth flow using the generic url as described by emmanual in this post years ago:
[New Feature] Using a generic redirect URL for OAuth providers - Announcements - Bubble Forum

But when I assemble my url and then navigate the user to it, after login, I get this response:
{“statusCode”:400,“body”:{“status”:“ERROR”,“message”:“Invalid state from oauth provider”}}

If I don’t include a state parameter in the assembled url, then I get the response “missing state parameter”

I have tried a bunch of things and it seems as though bubble is behind the scenes setting their own state parameter? Is this correct? anyone have any ideas?
Thanks in advance.

Can you share what you did? Bubble will include a state already if you use generic url…

Thanks for your help here.
I constructed the url like so:

I then use the “open an external website” action which is activated on a button click

Then that takes the user to the linkedin login screen and then on redirect, i get this:
image

I had this all working when I wasn’t using the generic url but I’ve had to switch as I need universal links to work as I am submitting an app to the app store using Natively as the wrapper.

You cannot use the generic url if you don’t use Bubble user-agent oAuth2 flow in API Connector. You are actually handle this manually, so you also need to use a page of your app to the redirect url and in this page, you can get the code to get token and authenticate user and use the state if needed. But using the manual process will not create a user account in Bubble like user-agent flow do in API Connector.

1 Like

Thanks so much. This is the info I needed. I have got this working using the user-agent flow. I had set this up once before on another app but totally had forgotten that this has the option to use the generic url

1 Like