Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing Scopes to cfaSignInGoogle #16

Closed
dalezak opened this issue Aug 29, 2019 · 5 comments
Closed

Providing Scopes to cfaSignInGoogle #16

dalezak opened this issue Aug 29, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@dalezak
Copy link

dalezak commented Aug 29, 2019

Is there a way to add scopes like https://www.googleapis.com/auth/drive when signing in to Google?

For example, when using firebase.auth().signInWithPopup directly, you can use addScope like:

let provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('https://www.googleapis.com/auth/drive');
provider.addScope('https://www.googleapis.com/auth/drive.file');
let response = await firebase.auth().signInWithPopup(provider);

I can login fine via cfaSignInGoogle but want to make sure the user has the correct permissions.

@dalezak
Copy link
Author

dalezak commented Aug 29, 2019

Looks like the plugin github.com/CodetrixStudio/CapacitorGoogleAuth let's you specify scopes in the capacitor.config.json

{
  "plugins": {
    "GoogleAuth": {
      "scopes": ["profile", "email"],
      "serverClientId": "xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"
    }
  }
}

Could something similar be done for capacitor-firebase-auth? Or perhaps passed as a parameter to cfaSignInGoogle?

@baumblatt baumblatt added the enhancement New feature or request label Aug 30, 2019
@baumblatt
Copy link
Owner

Hello Dale,

First, thank you for contribute for a better plugin, please enjoy version 0.2.1.

Your capacitor.config.json will look like this:

  "plugins": {
    "CapacitorFirebaseAuth": {
      "providers": ["google.com"],
      "permissions": {
        "google": [
          "https://www.googleapis.com/auth/drive",
          "https://www.googleapis.com/auth/drive.file"
        ]
      },
      "languageCode": "en",
      "nativeAuth": false
    }
  }

Please, don't forget to star the project and ask your teammates to do the same.

Let me know if everything work for you and we can close this issue.

Best regards,
Bernardo Baumblatt

@dalezak
Copy link
Author

dalezak commented Aug 30, 2019

Beautiful 👍

Simulator Screen Shot - iPhone SE - 2019-08-30 at 08 07 31

@dalezak dalezak closed this as completed Aug 30, 2019
@dalezak
Copy link
Author

dalezak commented Aug 30, 2019

@baumblatt maybe want to update the README as well?

@baumblatt
Copy link
Owner

@baumblatt maybe want to update the README as well?

Ops, I forgot the push of changes.

Thank you for the reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants