Using pound/hashtag symbol as a parameter

I need to self-handle the Google YouTube OAuth set up and when the user is redirected back to my app, the URI uses a hashtag like this https://app.example.com/version-test/youtube/#state=12345&access_token=56898&token_type=Bearer&expires_in=3599&scope=https://www.googleapis.com/auth/youtube.readonly%20https://www.googleapis.com/auth/youtube.force-ssl

The workflow I have in place to recognize the existence of “state” and “access_token” in the URL parameters is not working/not recognizing these params. I attempted to set up an action to send to the same URL with find # & replace with ? but to no avail - still doesn’t work. Is there another way to extract params after a “#” symbol using Bubble?

This gives me nightmares…

So I think what # means in this case is “never send this to the server” so you have to try to extract it in a different way.

There will be a thread from years ago with me tearing my hair out over this. Sadly my brain is a seive and I can’t remember if I solved it !

If you are running the workflow client side and you need to extract the value of “state” you can try:

this url
extract with regex #.*state=(.+?)(?=&|$)
first item
split by =
last item

replace “state” with “acces_token” to get the token

1 Like

Haha I love this response @NigelG . I am out of hair to tear out and my brain is in a similar state of affairs. Thank you for this.

Thanks @dorilama that simple solution crushed it. So very much appreciated.

1 Like

I’m happy it helped you :slight_smile:

Cheers
Mariano

This was pre-regex in native bubble, so I had to send it to an external service to parse out the return
token, but these “fragments” are not sent to the server which was annoying.

1 Like

I can’t imagine not having regex. :scream: