pocketbase / dart-sdk

PocketBase Dart SDK
https://pub.dev/packages/pocketbase
MIT License
511 stars 51 forks source link

Google oauth2 #31

Closed elsacutealways closed 1 year ago

elsacutealways commented 1 year ago

How to send google oauth2 initial request?

ganigeorgiev commented 1 year ago

You can find a web example flow in https://pocketbase.io/docs/authentication/#web-oauth2-integration.

For Dart, the expected flow should be similar, aka, you need 2 handlers:

  1. Somewhere to show the "Login with ..." links. The auth urls could be generated via pb.collection(collectionIdOrName).listAuthMethods().

  2. Somewhere to handle the Provider redirect (aka. deeplink) and perform the actual OAuth2 -> PocketBase authentication

If you still have questions, please file a new Q&A discussion in the main repo.

Please also note that the OAuth2 flow will be simplified in the near future as part of #55.

elsacutealways commented 1 year ago

Any dart code examples? Why this is not described in the docs?

ganigeorgiev commented 1 year ago

Sorry, there are no Dart examples for that at the moment.

You can check the community provided example in https://github.com/pchasco/pocketbase_google_login_flutter (and its discussion in https://github.com/pocketbase/pocketbase/discussions/442).

Why this is not described in the docs?

Because I don't have time and there are other tasks with higher priority at the moment. Docs contributions are welcomed (you can find the site repo in https://github.com/pocketbase/site).