Skip to main content

Overview

mgPass is an identity and loyalty platform purpose-built for the MG Digital ecosystem. It handles authentication, authorization, user management, and rewards across all MG Digital products including adesa+, 3News, and partner integrations.

Architecture

mgPass runs entirely on Cloudflare’s edge infrastructure:

Three Surfaces

ServicePurposeDomain
auth-workerCore API — OAuth, users, RBAC, rewardspass.mediageneral.digital
admin consoleSSR admin dashboard for operatorsadmin.mgdm.dev (staging)
account portalUser self-service (profile, sessions, rewards)account.mgdm.dev (staging)

Infrastructure

  • Cloudflare Workers — Serverless compute at the edge
  • D1 — SQLite-compatible relational database for all persistent data
  • KV — Key-value store for sessions, caching, and feature flags
  • R2 — Object storage for user avatars and uploaded assets

Core Concepts

Users

Every person in the system has a user record with a unique ID, profile data (name, email, phone, avatar), and authentication credentials. Users can sign in with email/password or linked social accounts.

Applications (OAuth Clients)

External applications register as OAuth clients to authenticate users. Each app has a client ID, secret, redirect URIs, and configured scopes. App types include Traditional Web, SPA, Native/Mobile, and Machine-to-Machine.

API Resources and Scopes

API resources represent protected APIs (e.g., https://api.adesa.plus). Each resource defines scopes — granular permissions like stream:live or content:read. Scopes appear in JWT access tokens.

Roles

Roles are named collections of scopes. Assign roles to users to grant permissions across multiple API resources. Roles can be marked as default (auto-assigned to new users) or restricted to M2M clients.

Organizations

Organizations represent tenants — partner companies, enterprise clients, or business units. Members can have organization-scoped roles that are separate from their global roles.

Rewards

The loyalty engine lets partners award points to users based on configurable rules. Points accumulate toward tier upgrades and can be redeemed for catalog items or mobile money cashback.

API Authentication

mgPass uses three authentication methods:
Used by client applications to access user data and perform user-scoped operations. Obtained through the standard OAuth 2.0 authorization code flow.
Bearer tokens with the mgpass:admin scope, used by the admin console and administrative API clients. Required for all management endpoints.
Static API keys issued to reward partners, sent via the X-API-Key header. Used exclusively for the partner events endpoint.

Base URLs

EnvironmentURL
Productionhttps://pass.mediageneral.digital
Staginghttps://pass.mgdm.dev

Next Steps

OAuth Flows

Implement authentication in your application

Register an App

Set up your OAuth client