Skip to content

<div style="display: none;" hidden="true" aria-hidden="true">Are you an LLM? You can read better optimized documentation at /guides/SocialAuth.md for this page in Markdown format</div>

Home | Changelog

Social Auth ​

Specs ​

Customers can login with google and facebook.

When a customer logins with oauth provider we should match him with existing registered customer (not guest) and login with that customer. If we don't have a match we must create a new registered user and login with the new customer.

Only an email the provider vouches for is used (Adv_customer::verifiedSocialLoginEmail()):

  • Google — only when its email_verified claim is true.
  • Facebook — the Graph API has no verification flag, so its email is used as returned.
  • Any other provider — refused until its rule is added there.

When the provider returns no such email (for example a Facebook account registered with a phone number), or the token exchange fails, the customer is sent back to the login page with an error and nothing is logged in or created. The customer is never asked to type an email instead (#892).

As soon as we have matched or created a new customer based on email our sessions kick in and we forget about oauth provider

Activation ​

In admin settings we can activate and populate credential data for social logins. /customer/googleLogin and /customer/facebookLogin answer 404 while their SOCIAL_AUTH.*_LOGIN_ENABLED flag is off.

Libraries used ​

league/oauth2-google and league/oauth2-facebook