Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F540455
PhutilSlackAuthAdapter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhutilSlackAuthAdapter.php
View Options
<?php
/**
* Authentication adapter for Slack OAuth2.
*/
final
class
PhutilSlackAuthAdapter
extends
PhutilOAuthAuthAdapter
{
public
function
getAdapterType
()
{
return
'Slack'
;
}
public
function
getAdapterDomain
()
{
return
'slack.com'
;
}
public
function
getAccountID
()
{
$user
=
$this
->
getOAuthAccountData
(
'user'
);
return
idx
(
$user
,
'id'
);
}
public
function
getAccountEmail
()
{
$user
=
$this
->
getOAuthAccountData
(
'user'
);
return
idx
(
$user
,
'email'
);
}
public
function
getAccountImageURI
()
{
$user
=
$this
->
getOAuthAccountData
(
'user'
);
return
idx
(
$user
,
'image_512'
);
}
public
function
getAccountRealName
()
{
$user
=
$this
->
getOAuthAccountData
(
'user'
);
return
idx
(
$user
,
'name'
);
}
protected
function
getAuthenticateBaseURI
()
{
return
'https://slack.com/oauth/authorize'
;
}
protected
function
getTokenBaseURI
()
{
return
'https://slack.com/api/oauth.access'
;
}
public
function
getScope
()
{
return
'identity.basic,identity.team,identity.avatar'
;
}
public
function
getExtraAuthenticateParameters
()
{
return
array
(
'response_type'
=>
'code'
,
);
}
protected
function
loadOAuthAccountData
()
{
return
id
(
new
PhutilSlackFuture
())
->
setAccessToken
(
$this
->
getAccessToken
())
->
setRawSlackQuery
(
'users.identity'
)
->
resolve
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 9:38 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
111661
Default Alt Text
PhutilSlackAuthAdapter.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment