Files
Fitness/web/html/auth.php
T

27 lines
729 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require __DIR__ . '/../vendor/autoload.php';
use Jumbojett\OpenIDConnectClient;
session_start();
$config = require __DIR__ . '/../config.php';
$oidc = new OpenIDConnectClient(
$config['provider_url'],
$config['client_id'],
$config['client_secret']
);
// Tell the library where to return after the user logs in
$oidc->setRedirectURL($config['redirect_uri']);
// Tell it which scopes we want
$oidc->addScope($config['scopes']);
// The OIDC flow we’ll use
$oidc->setResponseTypes([$config['response_type']]);
// Optional: for local development you can relax TLS validation
// $oidc->setVerifyHost(false);
// $oidc->setVerifyPeer(false);
$oidc->authenticate(); // This automatically redirects to Authelia