requestUserInfo('email'); } catch(Exception $e) { try { $oidc->authenticate(); $id=$oidc->requestUserInfo('email'); } catch(Exception $e) { echo "reauthentication failed."; exit(0); } } if(!isset($id)) { echo "could not get login name from oidc session\n"; exit(0); } # if we are on the first request from the oidc provider, send a redirect if(isset($_GET['code'])) { header("Location: ."); exit(0); } } else { try { $oidc = new OpenIDConnectClient('https://id.tilde.green/realms/tgci', 'CLIENTID', 'CLIENTSECRET'); $oidc->authenticate(); #$name = $oidc->requestUserInfo('user_id'); } catch (Exception $e) { echo '
Caught exception: ',  $e->getMessage(), "\n";
    echo $e->getTraceAsString(), "
\n"; exit(0); } $_SESSION['oidc']=$oidc; if(isset($_GET['code'])) { header("Location: ."); exit(0); } }