Score:1

How can I implement sign in with Google / Apple for a decoupled site?

cn flag

I have a decoupled Drupal site that uses JSON:API to serve an Ionic React app.

I'm currently using the JWT (JSON Web Token Authentication module to enable users to register and log in (alongside the Get JWT on Login module) to the app/Drupal site.

I have used the Email Registration module so that users only need to provide an email address and password to log in, so the sign-up form is very simple.

Now, I want to integrate "sign in with Google" and "sign in with Apple" functionality to make it easier for users on Android and iOS.

Requirements

Score:1
cn flag

At this time, it doesn't seem like a ready-made solution is available yet for Drupal 9.

Solution: OpenID Connect

One solution is to use the OpenID Connect module with the Simple OAuth module or the OAuth2 Server module. These modules do similar things but OAuth2 Server is less opinionated/more complex to set up.

OpenID Connect module provides support for Google out of the box; Apple support needs to be written, but work is ongoing here.

Solution: Social Auth

The Social Auth family of modules provides both Google and Apple submodules; however, the Social Auth Decoupled module does not have a Drupal 9 release, and it is looking for a new maintainer.

At a minimum, Social Auth Decoupled and Social Auth Google API would need to be updated for Drupal 9, and a Social Auth Sign in with Apple module would need to be written.

So, Social Auth is good if you don't need decoupled login, but if you do need decoupled, you will be writing a lot of code on your own.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.