4 * Authentication adapter for Slack OAuth2.
6 final class PhutilSlackAuthAdapter
extends PhutilOAuthAuthAdapter
{
8 public function getAdapterType() {
12 public function getAdapterDomain() {
16 public function getAccountID() {
17 $user = $this->getOAuthAccountData('user');
18 return idx($user, 'id');
21 public function getAccountEmail() {
22 $user = $this->getOAuthAccountData('user');
23 return idx($user, 'email');
26 public function getAccountImageURI() {
27 $user = $this->getOAuthAccountData('user');
28 return idx($user, 'image_512');
31 public function getAccountRealName() {
32 $user = $this->getOAuthAccountData('user');
33 return idx($user, 'name');
36 protected function getAuthenticateBaseURI() {
37 return 'https://slack.com/oauth/authorize';
40 protected function getTokenBaseURI() {
41 return 'https://slack.com/api/oauth.access';
44 public function getScope() {
45 return 'identity.basic,identity.team,identity.avatar';
48 public function getExtraAuthenticateParameters() {
50 'response_type' => 'code',
54 protected function loadOAuthAccountData() {
55 return id(new PhutilSlackFuture())
56 ->setAccessToken($this->getAccessToken())
57 ->setRawSlackQuery('users.identity')