How to use editor with authenticated user

I’ve got Supabase Auth setup with a 3rd party SSO (Microsoft)

In the editor the user object is always null. How can I test with an authenticated user? It’s annoying because I can’t use the formula interface to edit dynamic values. For example, I have to go to JS and do:

return { “Authorization”: "Bearer "+pluginVariables[‘1fa0dd68-5069-436c-9a7d-3b54c340f1fa’][‘user’][‘_session’][‘access_token’] }

Instead of just using the editor for something like:

{ “Authorization”: "Bearer "+ Supabase User->Session->Access Token }

And everytime I accidentally switch from JS view to Formula view it erases the custom JS.

Did you set the editor as callback URL in supabase settings?

Yes I have a login workflow that splits based on browser environment:

The editor path has the redirect set to the editor URL

Editor | WeWeb

xxxx was added by me here since those are back-end ids better to be safe.

The default flow uses the page as the redirect.

When I try to login from the editor it redirects back to the main https://editor.weweb.io/ page.

Callback URL is different from redirect URL, you can find callback url settings in supabase auth. Add editor, staging and your main website address, and they will all work.

Btw, you don’t need to split the login like that, the redirect will go to the right enviroment by itself.

Perfect. I had https://editor.weweb.io/* there already so thought the wildcard would cover it, but switched it to the redirect page url on the supabase side and now it’s working.

Thanks.

They are actually called by redirect URLs in supabase auth as well.

Here you can read about it:

It’s basically a list over what URL’s supabase auth are allowed to redirect to, it doesn’t help to try to redirect to the editor, unless the URL is added at supabase side.

Great!

Looks like I needed a double wildcard to make the wildcard work since single wildcard doesn’t cover separator characters.

1 Like