guruahn / vue-google-oauth2

🔌 Handling Google sign-in and sign-out for Vue.js applications
MIT License
183 stars 55 forks source link

Can't manage multiple instances #60

Closed philchass closed 1 year ago

philchass commented 3 years ago

The package can't manage multiples instances of authorization => rights in the same app.

It could be nice to name the variable this.$gauth to manage multiples rights (scopes) when we ask for this.$gAuth.getAuthCode()

chenlevy commented 3 years ago

That will be very useful for me also

adamposledni commented 2 years ago

@philchass @chenlevy

Solution I needed something similiar for my app. I have made few changes so the plugin supports multiple scopes.

Forked and updated code here

How to use it with Vue.js app

in main.js

const gauthOption = {
  clientId: 'xxx', // only client id is neede -> you don't set prompt and scopes globally anymore
};

Vue.use(GAuth, gauthOption);

in your components

const googleUser = await this.$gAuth.signIn({
    prompt: "select_account", 
    scope: "profile email", // you can now specify scopes for every gAuth method call
});
const authResponse = googleUser.getAuthResponse();
guruahn commented 1 year ago

This plugin does not support the new Google authentication system(GIS). You need to migrate by referring to this document. I'm sorry to tell you this news.