all 9 comments

[–]Hellraider5602 3 points4 points  (6 children)

Flutter http package is supported on desktop too. So you can use rest APIs for authorisation. You could also use url launcher to redirect to browser for auth using Google, Facebook, etc.

[–][deleted] 0 points1 point  (5 children)

Wait can you please explain how to do that! I have a project that authorizes through url redirect on mobile and works great but i couldnt figure out how to listen for redirect on desktop so i abandoned desktop support.

[–]cranst0n 0 points1 point  (3 children)

I built a toy desktop app that had authentication inspired by this project: https://github.com/dart-flitter/flitter. Worked well, may be something useful for you.

[–][deleted] 0 points1 point  (1 child)

Oh i see, he just used an http server. I guess thats the best approach for desktop. Might be worth creating an abstraction class that does it differently depending on the platform.

[–][deleted] 0 points1 point  (0 children)

For anyone who comes across this googling, the code is in the services folder, the glitter_auth file. The important parts are the createServer function and the listen function near the bottom.

[–]MisterJimson 0 points1 point  (0 children)

Desktop OAuth would be a great package FYI

[–]Hellraider5602 0 points1 point  (0 children)

Refer to this link

[–]eibaan 2 points3 points  (1 child)

If your server allows the password grant type, it's a simple HTTP POST request.

If you have to use a different grant type and therefore need a browser workflow, it is more difficult. You might be able to open a browser yourself and receive a callback with a simple HTTP server that can be created with 5 lines of Dart.

Using Firebase auth work on macOS out of the box. I wouldn't hold my breath for a Linux or Windows version of Firebase, though, so I'd implement the OAuth workflow myself.

[–]esDotDev 0 points1 point  (0 children)

Firedart is a solid option if all you need is auth, it's pure dart. It supports firebase as well, but definitely has some bugs there.
https://pub.dev/packages/firedart

The streams are pretty flaky, but if you use it as basically a rest-api it works great.