Replies: 8 comments 5 replies
-
@iamtommcc could you please show the code how to |
Beta Was this translation helpful? Give feedback.
-
Hi, Can I see the full main.rs and tauri.conf.json that you used for supabase authentication? I'm going through exactly same situation and new to tauri. It would be really really really helpful for me. |
Beta Was this translation helpful? Give feedback.
-
Hello, I cant seem to get this part to work properly. I have a command that I am invoking from the frontend that shows a predefined window when a button is clicked, and then changes the URL of that window:
But this does not trigger an My builder code:
I think this may have something to do with the fact that .on_page_load doesnt trigger for remote windows so I'm curious how you got it to work with an external authenticator. Any chance you could provide a more complete example of this? I'm new to Tauri and also having a lot of trouble with this. |
Beta Was this translation helpful? Give feedback.
-
@ryanrixxh I also was unable to get that approach to work. I have created an alternative example that does work in this gist. The key is using the |
Beta Was this translation helpful? Give feedback.
-
Hi folks, just came here to say that I created this simple project as example that makes login on Firebase through Google OAuth 2.0. Using OAuth Tauri Plugin to help the process. |
Beta Was this translation helpful? Give feedback.
-
Appimage same problem.... |
Beta Was this translation helpful? Give feedback.
-
I wrote a simple example for Supabase specifically using the OAuth Tauri Plugin as well! |
Beta Was this translation helpful? Give feedback.
-
Example: |
Beta Was this translation helpful? Give feedback.
-
This weekend I set out to implement a basic OAuth 2.0 login system for my Tauri App (a "Login via Google" experience powered by Supabase, specifically).
I found implementing this in Tauri surprisingly challening 🥴
After the login I could not redirect users back to the web application running in Tauri, since Apple doesn't allow Webviews to redirect to non-HTTP(S) protocols, preventing me from redirecting back to
tauri://localhost
As a workaround, I figured I could use a local web server as the redirect destination. So I had my app spin up a Rocket server to listen for the redirects. However, for the redirect, Supabase (and many other Oauth implementers) were passing the Oauth token/parameters via document fragments (
#foo=bar
instead of?foo=bar
) which the Webview doesn't ever send to the server. Dang!I figured I I could at least try to detect the webview's attempted redirect and "rip out" the document fragments of the target URL manually - this way, loading failure wouldn't matter. However, I couldn't find any way to listen to page load events for my newly created Oauth login window.
Ultimately my final solution was:
tauri.conf.json
that has no URL and is invisible by default. By having it defined pre-runtime, it gets properly picked up in the Tauri builderon_page_load
about:blank
is fine)show()
the login window and change the url viawry_window.eval("window.location.replace('http://my-oauth-login-page.com')")
on_page_load
, detect the final redirect (about:blank#access_token=123456
), pull out the details from the#
fragment, and emit them as neededIt works but the whole thing is quite unintuitive and fairly brittle!
Does anyone know if there's any cleaner solutions, or perhaps some APIs/events that I've missed? I suck at Rust so I wouldn't be surprised 😅
The few things that I feel would make Tauri a lot cleaner for this use case:
on_page_load
would be great (is this potentially a bug?)wry_window.load_url()
method (similar to what Electron offers) would feel a load better than the eval-basedlocation.replace()
technique!Beta Was this translation helpful? Give feedback.
All reactions