While trying to incorporate this library into symfony, I have gone into several issues.
Secondly I had to implement my own version of SlackProvider as follows, cause it failed on missing "access_token" key.
class SlackProvider extends AbstractProvider
{
public function getBaseAuthorizationUrl()
{
return 'https://slack.com/oauth/v2/authorize';
}
public function getBaseAccessTokenUrl(array $params)
{
return 'https://slack.com/api/oauth.v2.access';
}
public function getResourceOwnerDetailsUrl(AccessToken $token)
{
return 'https://slack.com/api/users.identity';
}
protected function getDefaultScopes()
{
return [];
}
protected function checkResponse(ResponseInterface $response, $data)
{
if (isset($data['ok']) && $data['ok'] === false) {
throw new IdentityProviderException($data['error'], null, $data);
}
}
protected function createResourceOwner(array $response, AccessToken $token)
{
if (!isset($response['user']['id'])) {
throw new IdentityProviderException('Missing user id', null, $response);
}
return new SlackResourceOwner($response);
}
protected function prepareAccessTokenResponse(array $result)
{
$result = parent::prepareAccessTokenResponse($result);
return [
'access_token' => $result['authed_user']['access_token'],
'resource_owner_id' => $result['authed_user']['id']
];
}
protected function getAuthorizationHeaders($token = null)
{
return ['Authorization' => 'Bearer ' . $token];
}
}
Does this library support only one flow? I was trying to login with slack in this case.