Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100472159
PhutilAsanaAuthAdapter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jan 31, 01:55
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Feb 2, 01:55 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23970894
Attached To
rPHU libphutil
PhutilAsanaAuthAdapter.php
View Options
<?php
/**
* Authentication adapter for Asana OAuth2.
*/
final
class
PhutilAsanaAuthAdapter
extends
PhutilOAuthAuthAdapter
{
public
function
getAdapterType
()
{
return
'asana'
;
}
public
function
getAdapterDomain
()
{
return
'asana.com'
;
}
public
function
getAccountID
()
{
return
$this
->
getOAuthAccountData
(
'id'
);
}
public
function
getAccountEmail
()
{
return
$this
->
getOAuthAccountData
(
'email'
);
}
public
function
getAccountName
()
{
return
null
;
}
public
function
getAccountImageURI
()
{
$photo
=
$this
->
getOAuthAccountData
(
'photo'
,
array
());
if
(
is_array
(
$photo
))
{
return
idx
(
$photo
,
'image_128x128'
);
}
else
{
return
null
;
}
}
public
function
getAccountURI
()
{
return
null
;
}
public
function
getAccountRealName
()
{
return
$this
->
getOAuthAccountData
(
'name'
);
}
protected
function
getAuthenticateBaseURI
()
{
return
'https://app.asana.com/-/oauth_authorize'
;
}
protected
function
getTokenBaseURI
()
{
return
'https://app.asana.com/-/oauth_token'
;
}
public
function
getScope
()
{
return
null
;
}
public
function
getExtraAuthenticateParameters
()
{
return
array
(
'response_type'
=>
'code'
,
);
}
public
function
getExtraTokenParameters
()
{
return
array
(
'grant_type'
=>
'authorization_code'
,
);
}
public
function
getExtraRefreshParameters
()
{
return
array
(
'grant_type'
=>
'refresh_token'
,
);
}
public
function
supportsTokenRefresh
()
{
return
true
;
}
protected
function
loadOAuthAccountData
()
{
return
id
(
new
PhutilAsanaFuture
())
->
setAccessToken
(
$this
->
getAccessToken
())
->
setRawAsanaQuery
(
'users/me'
)
->
resolve
();
}
}
Event Timeline
Log In to Comment