/** * Get a provider config for passing to the library. * * @param string $providerName * * @throws Exception\ConfigurationException * * @return array */ public function getProviderOptions($providerName) { $providerConfig = $this->config->getProvider($providerName); if (empty($providerConfig['clientId'])) { throw new Exception\ConfigurationException('Provider client ID required: ' . $providerName); } if (empty($providerConfig['clientSecret'])) { throw new Exception\ConfigurationException('Provider secret key required: ' . $providerName); } if (empty($providerConfig['scopes'])) { throw new Exception\ConfigurationException('Provider scope(s) required: ' . $providerName); } $options = ['clientId' => $providerConfig['clientId'], 'clientSecret' => $providerConfig['clientSecret'], 'scope' => $providerConfig['scopes'], 'redirectUri' => $this->getCallbackUrl($providerName)]; if ($providerName === 'Local') { $base = $this->config->getUrlRoot() . $this->config->getUriBase() . '/'; $options['urlAuthorize'] = $base . $this->config->getUriAuthorise(); $options['urlAccessToken'] = $base . $this->config->getUriAccessToken(); $options['urlResourceOwnerDetails'] = $base . $this->config->getUriResourceOwnerDetails(); } return $options; }