Abuja Digital Studio · Est. 2018
Start a Project
DocsOMembershipSocial Login, Magic Links & 2FA
Reference

Social Login, Magic Links & 2FA

OMembershiporravo.com/docs/omembership/social-login

Auth surface

The Engagement engine ships a complete auth surface that replaces the default WordPress login flow with a modern alternative. Source code lives under modules/engage/includes/Auth/ and is bootstrapped from OMembership engagement\Core\Plugin::boot().

Custom auth pages

Four pages are seeded on first install:

SurfaceShortcodeTemplate
Sign in[omembership_login]templates/frontend/sign-in.php
Register[omembership_register]templates/frontend/create-account.php
Profile[omembership_profile]templates/frontend/my-profile.php
Dashboard[omembership_dashboard]templates/frontend/my-dashboard.php

Page IDs are stored in the oe_settings option (login_page, dashboard_page).

Social login

Four providers are supported out of the box:

ProviderRequired credentialsOAuth endpoint
Googlegoogle_client_id + secretaccounts.google.com/o/oauth2/v2/auth
Appleapple_client_id + Team ID + Key ID + .p8appleid.apple.com/auth/authorize
GitHubgithub_client_id + secretgithub.com/login/oauth/authorize
LinkedInlinkedin_client_id + secretlinkedin.com/oauth/v2/authorization

The shared callback URL is:

https://yoursite.com/?oe_oauth_callback={provider}

State is generated as a one-time nonce, stored as a 10-minute transient, and validated on callback. Successful exchanges either log in an existing user (matched by email) or create a new account and store oe_social_{provider} user meta with the provider ID.

Magic links

Magic links are gated by oe_settings.enable_magic_link. The flow:

  1. POST /wp-admin/admin-ajax.php?action=oe_send_magic_link with email and the oe_frontend nonce.
  2. The handler creates a 48-char token, stores oe_magic_{token} as a transient (15-minute expiry), and asks EmailNotifier::send() to deliver the link.
  3. The user clicks https://yoursite.com/?oe_magic={token}, which sets the auth cookie and redirects to the configured dashboard page.

Tokens are single-use and rate-limited at the provider level. The response is identical whether or not the email exists (to avoid enumeration).

Two-factor authentication

Two methods ship:

  • TOTP - 32-char base32 secret, six-digit code, one-step window tolerance. Compatible with Google Authenticator, Authy, 1Password.
  • Email - six-digit code generated with random_int(), stored as a 10-minute transient, delivered via EmailNotifier::send( $user_id, '2fa_code', ... ).

Backup codes are generated on TOTP setup and stored as bcrypt hashes. Settings live under Engagement -> Auth -> 2FA.

Brute force protection

BruteForce::register() records every failed attempt in wp_or_login_attempts (indexed by ip_address, attempted_at). Default policy: 5 failures per IP in 10 minutes -> 30-minute lockout. IP whitelisting is available in settings.

Social Login, Magic Links & 2FA · OMembership Docs | Orravo