Skip to content

Commit

Permalink
ability to add custom auth params such as redirect and client_id (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
rossb220 authored Feb 16, 2017
1 parent f0adddc commit 68930d5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/Client/Oauth/BookboonProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,39 @@ private function getPreparedScopes()
}
}

protected function getAuthorizationParameters(array $options)
{
if (empty($options['state'])) {
$options['state'] = $this->getRandomState();
}

if (empty($options['scope'])) {
$options['scope'] = $this->getDefaultScopes();
}

$options += [
'response_type' => 'code',
'approval_prompt' => 'auto'
];

if (is_array($options['scope'])) {
$separator = $this->getScopeSeparator();
$options['scope'] = implode($separator, $options['scope']);
}

$this->state = $options['state'];

if (false === isset($options['client_id'])) {
$options['client_id'] = $this->clientId;
}

if (false === isset($options['redirect_uri'])) {
$options['redirect_uri'] = $this->redirectUri;
}

return $options;
}

/**
* @inheritdoc
*/
Expand Down

0 comments on commit 68930d5

Please sign in to comment.