As I was researching ways to integrate google login
to my app, I found several different ways:
With all these options at hands, I'm not very sure what would be the best choice to implement. No. 1(due to deprecated) and 5(for large customizable apps) are not my choices. So, I'm wondering between GIS and Third party libs, owing to the confusion added atop by no. 3.
I'm wondering if these libraries internally had integrated Gapi, since it appears to be the oauth2.0 libraries that google had published and hence these libs might all be deprecated, or they'd upgrade to GIS in which case we don't need these libraries?
What would be the rationale to choose between these two approaches? Whether to integrate a google made sdk/lib or a third party lib? And how would I know if the libs have updated to google's new policies and gapi's deprecation if they'd used it?
Edit: Also, wonder if these libraries would support the FedCM , which they state to be crucial after the third party cookie migration. It does seem looking at their source code, they use one lib called oauth4webapi for next/auth's implementation( maybe others as well?) , yet I can't seem to find anything mentioning FedCM in their docs. Similar stuff goes for passport-js
's oauth implementation
(I believe uses oauth , last published 2 years ago)
With so many ways to integrate Google Login, it can be hard to choose. Here's a brief guide:
npm install next-auth
import NextAuth from 'next-auth
import GoogleProvider from 'next-auth/providers
export default NextAuth({
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
],
});
.env
:
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
You will have to look at the repositories for next-auth and passport to see if or when they will be updated with FedCM support. They may take a bit of time to catch up with these changes.
Hope this helps! Let me know if you have more questions.