I'm trying to develop a SPA with multiple external login providers. So far I've implemented Microsoft (using MSAL). Now I want to do the same with Google. Sadly I'm unable to it as easy as with Microsoft's library.
In Microsoft I do something like this (simplified):
const client = new PublicClientApplication({auth: {clientId: '123'}})
const tokenResponse = await client.getTokenSilent({scopes: ['openid']})
Now in Google I noticed there is no async or promise based APIs. In general the API is very very limited. I tried:
renderButton function because the Login component is not visible all the time and not visible immediately.
In any of the above cases I need to add a callback to Google client configuration. This is very annoying because everywhere I use promises/async/await and only here I cannot use it (have to create workarounds). Sadly the callback is also only triggered when a successful response is triggered. If the user cancels the popup my load spinner (blocking the login page) can never be disabled because I have no callback on that.
Microsoft provides their login library (MSAL) via NPM (free and open source available) but Google does not seem to do this to any degree. Or am I missing something.
Soo.... Sorry for my rant. I never really worked with Google APIs/libraries and I'm kinda happy that I never had to yet. I'm astonished that Googles library is so bad in "modern developer experience".
Is there an easier way to do this?