[SOLVED] - Multiple LoginWithGoogle options

Hello,

I run a multitenant app where each customer have their own domain name and white brand app.
It is still on DB, I want to allow separate children to login with their google credentials into my app.

So I have differents clientId et secret, how can I easily do that with loginWithGoogle function ?

Thanks

I thing you would need a Firebase app for each of your clients. From creating these apps, you get your credentials for google login. (ok, I see that is covered)

I am not aware of any ready-made solution but …
What I would do is to add multiple services in the configuration via the settings.json file and registered them as usual.
Ex:

{
  "private": {
    "oAuth": {
        "googleOneClient": {
            "clientId": "........apps.googleusercontent.com",
            "secret": "xxxxxxxx",
            "loginStyle": "popup",
            "scope": ["email", "https://www.googleapis.com/auth/plus.login"]
        },
         "googleAnotherClient": {
            "clientId": "........apps.googleusercontent.com",
            "secret": "xxxxxxxx",
            "loginStyle": "popup",
            "scope": ["email", "https://www.googleapis.com/auth/plus.login"]
      }
    }
  }
}

Then I’d take a local copy packages for google_client (meteor/google_client.js at ffcfa5062cf1bf8a64ea64fef681ffcd99fe7939 · meteor/meteor · GitHub) and modify it so that I can pass configurations dynamically.

Line 27 I think you could pass the service dynamically using one key on the options object. options are passed from the client via the Meteor.loginWithGoogle(options, callback).

1 Like

Thanks ! This is really a good starting point will deep into that