chameleon-system-private/social-login
Social Login Bundle
Requires
- chameleon-system/chameleon-base: ~8.0.0
- chameleon-system/chameleon-shop: ~8.0.0
- google/apiclient: ^2.18
- web-token/jwt-framework: ^3.4.7
- 8.0.x-dev
- 8.0.45
- 8.0.44
- 8.0.43
- 8.0.42
- 8.0.41
- 8.0.40
- 8.0.39
- 8.0.38
- 8.0.37
- 8.0.36
- 8.0.35
- 8.0.34
- 8.0.33
- 8.0.32
- 8.0.31
- 8.0.30
- 8.0.29
- 8.0.28
- 8.0.27
- 8.0.26
- 8.0.25
- 8.0.24
- 8.0.23
- 8.0.22
- 8.0.21
- 8.0.20
- 8.0.19
- 8.0.18
- 8.0.17
- 8.0.16
- 8.0.15
- 8.0.14
- 8.0.13
- 8.0.12
- 8.0.11
- 8.0.10
- 8.0.9
- 8.0.8
- 8.0.7
- 8.0.6
- 8.0.5
- 8.0.4
- 8.0.3
- 8.0.2
- 8.0.1
- 7.1.x-dev
- 7.1.139
- 7.1.138
- 7.1.137
- 7.1.136
- 7.1.135
- 7.1.134
- 7.1.133
- 7.1.132
- 7.1.131
- 7.1.130
- 7.1.129
- 7.1.128
- 7.1.127
- 7.1.126
- 7.1.125
- 7.1.124
- 7.1.123
- 7.1.122
- 7.1.121
- 7.1.120
- 7.1.119
- 7.1.118
- 7.1.117
- 7.0.23
- 7.0.22
- 7.0.21
- dev-main
- dev-66480-paypal-button-integration-wip
- dev-65797-paypal-button-integration
- dev-65797-paypal-checkout-7.1.x
- dev-64817-update-tag-manager-bundle
README
Styling Requirement
Bootstrap v5
Project Purpose
The Bundle is designed to provide seamless authentication using social login providers such as Apple and Google. It enables users to authenticate securely via OAuth, ensuring a smooth and standardized login experience. The system verifies the identity of users through token-based authentication and integrates with the application's user management system.
Theme
To add the templates of the bundle, please add the following entry to your theme:
@EsonoSocialLoginBundle/Resources/views
Modifications / Special Case
You need to update the edit-profile-password.view.php as it is not possible
to update / edit the existing password on a social login user.
Maybe you can integrate a text like this:
Ihr Kunden-Konto ist mit einem Social Login (Apple oder Google) verknüpft.
Um ein (neues) Passwort zu vergeben, nutzen Sie bitte die Passwort-Vergessen Funktion.
Main Components
The project is structured into several key components that interact to facilitate authentication and user management.
1. Controller Layer
SocialLoginController.php: Manages authentication requests, processes login responses, and redirects users after authentication.
2. Data Models
ApplePayload.php&GooglePayload.php: Represent authentication responses from Apple and Google.Payload.php: A base class ensuring consistency in handling authentication responses.
3. Entity Layer (Database Representation)
SocialLoginExtranetUser.php: Maps social login data to user accounts.SocialLoginMTExtranetCore.php: Stores metadata related to social login sessions.
4. Service Layer
SocialLoginSettingsDataAccess.php: Handles social login configuration settings.CustomerDataAccess.php: Retrieves and updates customer-related authentication data.
5. Token Verification & Security
AppleClientSecretGenerator.php: Generates client secrets for Apple authentication.
How Components Interact
- The user clicks the social login button (Apple or Google), triggering the authentication request.
- The request is handled by
SocialLoginController.php, which redirects the user to the provider’s OAuth endpoint. - The provider authenticates the user and returns an OAuth token.
- The Payload model extracts and processes the token data.
- The Service Layer verifies the token and determines whether the user should be logged in or registered.
- The Entity Layer persists user data in the database, ensuring session continuity.
Token Verification Process
Token verification is a crucial security step that ensures the authenticity of authentication responses.
1. Retrieving the Token
After successful authentication, Apple or Google provides an ID token (JWT). This token contains claims about the authenticated user.
2. Decoding and Validating the Token
Google Token Verification
- Retrieve the ID token from Google’s authentication response.
- Decode the JWT and extract its claims.
- Validate the token's signature using Google’s public keys.
- Verify the claims (
iss,aud,exp, etc.). - Extract user details for further processing.
Apple Token Verification
- Fetch Apple’s public keys from
https://appleid.apple.com/auth/keys. - Validate the JWT signature against Apple’s keys.
- Check that required claims (
sub,aud,exp) are valid. - Validate the client secret against the stored credentials.
3. Processing User Data
- Extract user data (ID, email, etc.) and match it with existing records.
- If a user exists, they are logged in.
- If not, a new user account is created.
4. Handling Token Expiry and Errors
- Ensure the token has not expired (
expclaim). - Handle invalid or tampered tokens gracefully.
- If supported, use refresh tokens for session continuity.
How to Obtain Required Authentication Credentials
Apple Credentials
1. Generating the Apple Client ID
- Visit: Apple Developer Account
- Navigate to Certificates, Identifiers & Profiles → Identifiers.
- Create a new Identifier and select App IDs.
- Enable the capability Sign in with Apple.
- Note the Client ID generated.
2. Obtaining the Apple App ID
- Go to Apple Developer Account.
- Navigate to Certificates, Identifiers & Profiles → Identifiers.
- Create a new App ID and ensure Sign in with Apple is enabled.
3. Setting up Website-URL and Return Url
- Navigate to Certificates, Identifiers & Profiles → Identifiers.
- Change Top-Right from App IDs to Service ID

- Select the previously created Primary App ID.
- Enable Sign in with Apple and press the Button Configure
Configure the Website Urls. There are 2 elements you need to configure
a) Website-URL (Domains & Subdomains) Example: genialokal.de or genialokal.stage.esono.net
b) Return URL's: Full Return Url's including Protocol and Path: Example: https://genialokal.de/social-login/apple/callback
- Save the generated App ID for integration.
3. Retrieving the Apple Key ID
- Go to Certificates, Identifiers & Profiles.
- Create a new Authentication Key.
- Select Sign in with Apple as the service.
- Save the Key ID generated.
4. Generating the Apple Client Secret (Private Key File)
- Navigate to Apple Developer Key Management.
- Generate a new key for Sign in with Apple.
- Download the private key (
.p8file) securely. - Use this key to generate the client secret in your application.
Google Credentials
1. Generating the Google Client ID
- Visit the Google Cloud Console.
- Select an existing project or create a new one.
- Navigate to APIs & Services → Credentials.
- Click Create Credentials and choose OAuth 2.0 Client ID.
- Set the application type to Web Application.
- Enter the authorized redirect URIs (e.g.,
https://yourdomain.com/auth/google/callback). - Click Create, and your Client ID will be generated.
- Save the Client ID and Client Secret securely.
Examples of Different Apple Login Responses
- User Shares Email:
{ "email": "user@example.com", "sub": "000123456789ABCDE" } - User Uses Private Email Relay:
{ "email": "random@privaterelay.appleid.com", "sub": "000123456789ABCDE" }