#Open URL in Default Browser from Tauri Application

12 messages · Page 1 of 1 (latest)

tawdry dagger
#

is there a way to open the browser from the JS code?

I have tried "window.open(URL)" but it opens WebView 2 window
also tried creating an element with JS and clicking it but still opens WebView 2 window

slim sentinel
tawdry dagger
#

Worked like a charm, Thank you

stuck cipher
strong niche
#

can I return an auth access token after the browser opens and the user authenticates?

pine jungle
#

you can use this :
import { open } from "@tauri-apps/api/shell";

export const openlink = async (link: string) => {
await open(link);
};

strong niche
#

and how to return the access-token?

pine jungle
#

@strong niche Do you intend to implement login authentication functionality such as "login with Google or Facebook, etc."? Is that correct?

strong niche
#

I try with microsoft login for reading and storing a folder and file in onedrive. next is gdrive and in the end a webdav implementation for anyone that prefers it

pine jungle
#

@strong niche ok to do that you want to use MicrosoftLogin from Microsoft Graph SDK for JavaScript

strong niche
#

yes but there is an issue, with webview popup or with a express server at localhost:3000 I cannot get the access token back to my app to actually run some API

the only thing I can do is open either redirect or popup or express server and the webview/browser logins but thats it I cant use the access token in my app

#

I am currently trying to use Updating git repository tauri-plugin-oauth