Install M7 Identity SDK for a website

Connect to M7 Identity

Issuer: https://sso.user.m7.org

Discovery JSON: https://sso.user.m7.org/.well-known/openid-configuration

Live discovery supplies endpoint locations and advertised capabilities. Use the provider profile for the integration contract and current testing status.

The prepared Token/PHP 0.1.5-rc.1 candidate adds receiver-authenticated organization lookup, ACL member management and canonical org principal references. The verified public download remains 0.1.4. See candidate support status before selecting those additions.

Choose web-php for browser login and session handling, token-php for local backend token validation, or both when the website has both responsibilities.

This guide installs the current Web/PHP 0.1.6 and Token/PHP 0.1.4 downloads. Their optional encryption/native features need the documented native runtime. Neither the compiled PHP extension nor the separate C library is required for ordinary base SDK installation.

Install web-php

Stable release 0.1.6 is live and distributed as:

m7-identity-web-php-0.1.6.zip
m7-identity-web-php-0.1.6.zip.sha256
m7-identity-web-php-0.1.6.zip.manifest.json

Download the ZIP, SHA-256 checksum, and release manifest. All three matched the immutable release on 2026-10-11.

1. Collect registration values

Before installing, obtain the application's HTTPS origin, M7 client ID, registered token-endpoint authentication method, client secret when applicable, authorization and token endpoints, Identity acknowledgement endpoint, current and successor fingerprints, refresh mode, and post-login URL.

For the default installation path, register this redirect URI exactly:

https://YOUR_APPLICATION_ORIGIN/m7_sso_session/callback

2. Verify and extract the release

Keep the archive and checksum sidecar together, then verify with one available platform command:

shasum -a 256 -c m7-identity-web-php-0.1.6.zip.sha256
sha256sum -c m7-identity-web-php-0.1.6.zip.sha256

Extract into a non-public staging directory:

unzip m7-identity-web-php-0.1.6.zip -d ./staging

Copy only the extracted m7_sso_session directory into the application's public document root without renaming it. Keep documentation, examples, manifests, checksums, and install receipts outside the public root.

3. Configure the PHP worker

For an organization application using hosted tenant login, use the complete tenant Apache configuration and login-group setup. The installed SDK is the same; the authority endpoints and registered client values change.

Supply the registered M7_* settings through the trusted Apache, PHP-FPM, or deployment secret environment. At minimum, configure the public origin, base path, client identity, registered client-authentication method, applicable secret, authorization and token endpoints, acknowledgement endpoint, fingerprints, refresh mode, pending-envelope key, and post-login URL.

In stable web-php 0.1.6, M7_FINGERPRINT and M7_NEW_FINGERPRINT accept the exact registered 32-byte value as either 64 hexadecimal or 43 canonical unpadded base64url characters. The SDK normalizes both inputs to the server's unchanged lowercase hexadecimal wire format. M7_PENDING_ENVELOPE_KEY accepts the same two encodings but remains a Web-SDK-local secret and is never sent to SSO.

Do not put a .env file, client secret, or pending-envelope key inside m7_sso_session. Reload the actual web PHP worker after configuration changes; the CLI and web worker may load different environments.

4. Configure routing

For Apache, enable mod_rewrite, permit FileInfo overrides for the installed directory, and disable directory indexes. Another web server must reproduce the package's extensionless route table, serve intended static files, deny direct root PHP filenames, and return 404 for unknown package paths.

5. Verify the installation

Lint the staged PHP files before deployment:

find ./staging/m7-identity-web-php-0.1.6/m7_sso_session -type f -name '*.php' -exec php -l {} \;

After reloading the web server and PHP worker, confirm that:

  • /m7_sso_session/ starts the configured login flow;
  • a GET request to the POST-only /m7_sso_session/me route returns 405;
  • direct requests for package PHP filenames are rejected;
  • unknown package paths return 404; and
  • the browser can load the package's versioned DPoP module.

Complete a non-production login, callback, acknowledgement, /me, /profile, refresh, and logout flow before using a production client registration.

Add the Active Tags sign-in UI

The optional sign-in integration guide covers one link selecting full-page, popup or iframe sign-in, a PHP-included modal and completion on the current page. It requires the compatible Web/PHP 0.1.6 + Active Tags 0.1.1 pair. The Web/PHP 0.1.6 release installed above supplies the background-completion APIs; Active Tags remains a separate prepared package. Check its publication status.

The Active Tags ZIP includes deployable HTML/CSS/JS, the small application POST adapter and matching include examples. It expects the consumer's Active Tags runtime, dialog/tab services and general styles. For customization, edit its source and run npm ci followed by npm run build with Node.js 20+. See the default install layout and build commands.

Install token-php for backend validation

Stable release 0.1.4 is distributed with its checksum and manifest sidecars as m7-identity-token-php-0.1.4.zip.

Download the ZIP, SHA-256 checksum, and release manifest.

Verify the checksum, extract the package outside the public document root, and load its bundled autoloader:

require_once '/path/to/m7-identity-token-php-0.1.4/autoload.php';

The package requires PHP 8.1 or newer and OpenSSL. cURL is recommended for certificate retrieval, introspection, and UserInfo; supported PHP streams are the fallback transport.

Create the facade and validate an incoming serialized token with policy that is specific to the protected application:

use M7\Identity\M7IdentitySDK;

$identity = new M7IdentitySDK();
$report = $identity->validate($incomingAccessToken, [
    'audience' => 'https://api.example.m7.org/',
    'client_id' => 'YOUR_REGISTERED_CLIENT_ID',
    'principal_type' => 'consumer',
    'scope' => ['profile.read'],
    'cert_pem' => $trustedPublicCertificate,
]);

if (!$report->ok()) {
    throw new RuntimeException($report->reason());
}

The client_id policy above restricts the requesting app. Token/PHP 0.1.4 also supports m7 => ['target_client_id' => $receivingClientId] when restricting the receiving registered app; these identities differ during Token Exchange. This option is included in Token/PHP 0.1.4. Keep ID-token audience validation separate from access-token requester/target checks.

Do not use token claims for authorization until signature, issuer, audience, time, and applicable scope or DPoP policy have all passed.

Install organization and account-email operations

The verified Token/PHP 0.1.4 download includes managedOrganizations(), endpoint resolution, accountEmails(), all five Organizations/Emails classes, and the default facade. Install the complete archive above. Encryption retains its separate native runtime requirements. For usage see organizations and account emails.