-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: microsoft authentication scheme
- Loading branch information
1 parent
7ddd596
commit 7ee15ac
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use tauri::Manager; | ||
|
||
#[tauri::command] | ||
pub fn get_microsoft_auth_code(app_handle: tauri::AppHandle) { | ||
tauri::WindowBuilder::new( | ||
&app_handle, | ||
"oauth", | ||
tauri::WindowUrl::External( | ||
"https://login.live.com/oauth20_authorize.srf\ | ||
?client_id=00000000402b5328\ | ||
&response_type=code\ | ||
&prompt=login\ | ||
&scope=service%3A%3Auser.auth.xboxlive.com%3A%3AMBI_SSL\ | ||
&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf" | ||
.parse() | ||
.unwrap(), | ||
), | ||
) | ||
.title("Log in to Microsoft...") | ||
.on_navigation(|url| { | ||
let prefix = "https://login.live.com/oauth20_desktop.srf?"; | ||
let url = url.to_string(); | ||
if url.starts_with(prefix) { | ||
let auth_code = url.replace(prefix, ""); | ||
if let Some(app_handle) = crate::INSTANCE.get() { | ||
app_handle.emit_all("auth-code", auth_code).unwrap(); | ||
if let Some(window) = app_handle.get_window("oauth") { | ||
window.close().unwrap(); | ||
} | ||
} | ||
} | ||
true | ||
}) | ||
.build() | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod auth; | ||
pub mod runner; | ||
pub mod zip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters