← Back to all products

Social Login Integrator

$10

Google, GitHub, and Discord OAuth2 flows with unified user profile normalization.

📁 9 files
JSONMarkdownPython

📄 Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample

📁 File Structure 9 files

social-login-integrator/ ├── LICENSE ├── README.md ├── examples/ │ └── config.example.json ├── free-sample.zip ├── guide/ │ ├── 01_social-login-integrator.md │ ├── 02_features.md │ └── 03_quick-start.md ├── index.html └── src/ └── main.py

📖 Documentation Preview README excerpt

Social Login Integrator

Google, GitHub, and Discord OAuth2 flows with unified user profile normalization. Zero dependencies.

Part of the Auth Vault toolkit by [CodeVault](https://codevault.dev).

Features

  • Three providers: Google, GitHub, Discord (extensible pattern)
  • OAuth2 authorization code flow with PKCE option
  • CSRF protection via cryptographic state parameter
  • Unified user profile: id, email, name, avatar across all providers
  • Token exchange with error handling and retry
  • Provider-agnostic callback handler
  • CLI tool for authorization URL generation and callback testing
  • Zero dependencies — Python stdlib only

Quick Start


# Generate an authorization URL for Google
python3 src/main.py authorize --provider google \
    --client-id YOUR_GOOGLE_CLIENT_ID \
    --redirect-uri https://app.example.com/auth/google/callback

# Exchange a callback code for a user profile
python3 src/main.py callback --provider google \
    --code AUTH_CODE \
    --client-id YOUR_GOOGLE_CLIENT_ID \
    --client-secret YOUR_GOOGLE_SECRET

# Start the demo callback server
python3 src/main.py serve --port 8000

Using as a Library


from main import SocialLoginManager

social = SocialLoginManager()

# Configure providers
social.configure_provider("google",
    client_id="YOUR_GOOGLE_CLIENT_ID",
    client_secret="YOUR_GOOGLE_SECRET",
    redirect_uri="https://app.example.com/auth/google/callback",
)

# Generate auth URL (send user here)
url, state = social.get_auth_url("google")

# Handle callback (after user authorizes)
profile = social.handle_callback("google", code="AUTH_CODE", state=state)
print(f"Name: {profile.name}")
print(f"Email: {profile.email}")
print(f"Avatar: {profile.avatar_url}")
print(f"Provider: {profile.provider}")  # "google"

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/main.py #!/usr/bin/env python3 """ Social Login Integrator — Google, GitHub & Discord OAuth ========================================================= A unified social login system that handles OAuth2 flows for Google, GitHub, and Discord. Each provider is normalized into a common user profile format so your app doesn't care which provider was used. Why unified? Because every social provider has slightly different OAuth2 quirks, token formats, and profile endpoints. This handles the differences so you get a clean UserProfile regardless of source. Zero dependencies. Import or run as CLI. Part of the Auth Vault toolkit by DataNest. License: MIT """ from __future__ import annotations import hashlib import json import logging import os import secrets import time import urllib.parse import urllib.request from dataclasses import dataclass, field, asdict from datetime import datetime, timezone from http.server import HTTPServer, BaseHTTPRequestHandler from pathlib import Path from typing import Any # --------------------------------------------------------------------------- # Configuration # --------------------------------------------------------------------------- STORAGE_FILE = Path("./social_users.json") DEFAULT_HOST = "0.0.0.0" DEFAULT_PORT = 8084 CALLBACK_PATH = "/callback" # Provider configurations — replace with your actual credentials # In production, use environment variables PROVIDERS: dict[str, dict[str, str]] = { "google": { "client_id": os.environ.get("GOOGLE_CLIENT_ID", "YOUR_GOOGLE_CLIENT_ID_HERE"), "client_secret": os.environ.get("GOOGLE_CLIENT_SECRET", "YOUR_GOOGLE_CLIENT_SECRET_HERE"), # ... 537 more lines ...
Buy Now — $10 Back to Products