<?php

require __DIR__ . '/vendor/autoload.php';

/*
(https://dev.auth.igmetall.de):

Client-Id: teamigmetall-website
Secret: 2b8eba20-260a-4a1a-99e3-0a6453769323
Scopes: openid profile email igm_auth igm_account
*/

//file_put_contents(__DIR__ . '/claims.json', 'asdas');die();

use Jumbojett\OpenIDConnectClient;

$oidc = new OpenIDConnectClient('https://dev.auth.igmetall.de/auth/realms/igmetall/',
                                'teamigmetall-website',
                                '2b8eba20-260a-4a1a-99e3-0a6453769323');
$oidc->setRedirectURL('https://dev.teamigmetall.de/auth/redirect.php');
$oidc->addScope([/*'openid',*/ 'profile', 'email', 'igm_auth', 'igm_account']);
$oidc->authenticate();

/*
    no 'code' or 'state' in $_GET => Client redirects to OpenIdServer => then Login or Sessions => then returns to redirect.php
*/