Signia integrates Google and Facebook OAuth 2.0 social login through django-allauth, allowing users to sign in or register with an existing social account instead of creating a password. The implementation uses a customDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jtapieromalambo-ctrl/Signia/llms.txt
Use this file to discover all available pages before exploring further.
SocialAccountAdapter in usuarios/adapters.py that handles post-login routing, blocks re-registration of deactivated accounts, and automatically redirects users to the disability-selection screen on first login. OAuth configuration requires both credentials from the external provider’s developer console and a matching Social Application record in the Django Admin.
Google OAuth Setup
Open Google Cloud Console
Go to console.cloud.google.com and sign in with the Google account that will own the OAuth application. If you do not have a project yet, click Select a project → New Project and create one with an appropriate name (e.g.
signia).Enable the OAuth consent screen
In the left sidebar go to APIs & Services → OAuth consent screen. Select External as the user type (so any Google account can sign in), fill in the app name (
Signia), support email, and authorised domains. Save and continue through the remaining steps — you do not need to add any scopes beyond the defaults for basic login.Create an OAuth 2.0 Client ID
Go to APIs & Services → Credentials → Create Credentials → OAuth 2.0 Client ID. Choose Web application as the application type and give it a name. Under Authorised redirect URIs, add both the development and production callback URLs:Click Create. Google will display your Client ID and Client Secret — copy both values immediately.
Facebook OAuth Setup
The Facebook OAuth setup follows the same pattern as Google, using Facebook’s own developer console instead:Create a Facebook App
Go to developers.facebook.com and click My Apps → Create App. Choose Consumer as the app type, name it
Signia, and click through the creation wizard.Add Facebook Login product
On the app dashboard, click Add a Product and select Facebook Login → Set Up. Under Facebook Login → Settings, add the same redirect URIs used for Google but with the
facebook path:Registering OAuth Apps in Django Admin
Once you have credentials from the provider, register them as Social Application records so allauth can use them at runtime.Update the default Site record
Under Sites → Sites, click on the default site record (ID = 1). Change both Domain name and Display name to your production domain (e.g.
your-domain.up.railway.app). For local development only, you can leave it as example.com or change it to 127.0.0.1:8000.Create the Google Social Application
Under Social Accounts → Social applications, click Add social application and fill in:
Save the record.
| Field | Value |
|---|---|
| Provider | Google |
| Name | Google (or any descriptive label) |
| Client id | Your Google OAuth Client ID |
| Secret key | Your Google OAuth Client Secret |
| Sites | Move your site from Available to Chosen |
allauth Settings Reference
The relevant allauth settings active insettings.py are:
SOCIALACCOUNT_EMAIL_AUTHENTICATION_AUTO_CONNECT = True means that if a user signs in with Google using user@gmail.com and a local account with that same email already exists, allauth will automatically connect the Google login to the existing account rather than creating a duplicate. This prevents fragmented accounts when users switch between password login and social login.Custom Adapter Behaviour
TheSocialAccountAdapter in usuarios/adapters.py overrides four methods from allauth’s DefaultSocialAccountAdapter:
| Method | Behaviour |
|---|---|
is_open_for_signup | Blocks OAuth signup if the email belongs to a previously deactivated (is_active=False) account, showing an error message to the user |
save_user | Ensures is_active = True is set on the user record after OAuth sign-up |
get_login_redirect_url | Routes users to /seleccionar-discapacidad/ if they have not selected a disability profile yet; otherwise routes sordo users to /reconocimientos/camara/ and others to /traduccion/ |
get_signup_redirect_url | Always redirects newly registered OAuth users to /seleccionar-discapacidad/ to complete their profile |