sreeise / graph-rs-sdk

Microsoft Graph API Client And Identity Platform Client in Rust
MIT License
110 stars 29 forks source link

BUG Interactive authentication not supported on Mac OS #485

Open Yzoni opened 1 month ago

Yzoni commented 1 month ago

Describe the bug Interactive authentication currently does not support mac os. It is unable to build on mac os due to tao::platform::unix not being available.

The target_family is set to unix which is included in target arch aarch64-apple-darwin. https://github.com/sreeise/graph-rs-sdk/blob/7aa756af45fafec43156d798fff1c47c3fb04b9b/graph-oauth/src/interactive/interactive_auth.rs#L13-L14

Tao however only allows the following: https://github.com/tauri-apps/tao/blob/0af78a924958f0b91f94fe58c78f26569cffdf5f/src/platform/unix.rs#L5-L11

To Reproduce Steps to reproduce the behavior:

  1. Compile on mac os.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots

error[E0432]: unresolved import `tao::platform::unix`
  --> /src/index.crates.io-6f17d22bba15001f/graph-oauth-2.0.0/src/interactive/interactive_auth.rs:14:20
   |
14 | use tao::platform::unix::EventLoopBuilderExtUnix;
   |                    ^^^^ could not find `unix` in `platform`

Desktop (please complete the following information):

sreeise commented 1 month ago

Describe the bug Interactive authentication currently does not support mac os. It is unable to build on mac os due to tao::platform::unix not being available.

So this isn't necessarily a bug as much as it is an issue with macos not having the ability to run the webview on a separate thread. MacOs requires it being on the main thread and webview can cause the whole program to exit when the webview is closed.

I also don't have the ability to test on MacOS right now so theres that problem.

Regardless, the issue I mentioned above was before the interactive-auth was changed to use tao EventLoop run_return which should prevent the the program exiting. However, I can't guarentee that it will work because right now even with run_return we still run the webview on a separate thread and so this will probably just crash.

Even with that, I added a branch: https://github.com/sreeise/graph-rs-sdk/tree/interactive-auth-macos with the MacOs specific platform settings. @Yzoni can you test this branch on MacOS? And then let me know whether you are successful in using interactive-auth or if there were errors (and what the errors are)? That way I will know whether another update will need to be made to change how the thread handling works for MacOs.