- //TODO: discovery via link headers
- $sx = simplexml_load_file($url);
- if ($sx === false) {
- Log::err('Error loading URL: ' . $url);
- exit(1);
- }
- $sx->registerXPathNamespace('h', 'http://www.w3.org/1999/xhtml');
-
- $auths = $sx->xpath(
- '/h:html/h:head/h:link[@rel="authorization_endpoint" and @href]'
- );
- if (!count($auths)) {
- Log::err('No authorization endpoint found');
- exit(1);
- }
- $cfg->authorization = (string) $auths[0]['href'];