Toggle navigation
Toggle navigation
This project
Loading...
Sign in
UT
/
oauth_2-0_client_php
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Bastian Hofmann
2011-03-25 14:02:00 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b415f6d33c76d5e45e0c458507301b248731ab03
b415f6d3
1 parent
8c6b3d11
when refreshing the access token, do not discard old refresh token if a new one is not sent
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
oauth2.php
oauth2.php
View file @
b415f6d
...
...
@@ -192,15 +192,16 @@ class OAuth2_Service
$http
=
new
OAuth2_HttpClient
(
$this
->
_configuration
->
getAccessTokenEndpoint
(),
'POST'
,
http_build_query
(
$parameters
));
$http
->
execute
();
$this
->
_parseAccessTokenResponse
(
$http
);
$this
->
_parseAccessTokenResponse
(
$http
,
$token
->
getRefreshToken
()
);
}
/**
* parse the response of an access token request and store it in dataStore
*
* @param OAuth2_HttpClient $http
* @param string $oldRefreshToken
*/
private
function
_parseAccessTokenResponse
(
OAuth2_HttpClient
$http
)
{
private
function
_parseAccessTokenResponse
(
OAuth2_HttpClient
$http
,
$oldRefreshToken
=
null
)
{
$headers
=
$http
->
getHeaders
();
$type
=
'text'
;
if
(
isset
(
$headers
[
'Content-Type'
])
&&
strpos
(
$headers
[
'Content-Type'
],
'application/json'
)
!==
false
)
{
...
...
@@ -225,7 +226,7 @@ class OAuth2_Service
}
$token
=
new
OAuth2_Token
(
$response
[
'access_token'
],
isset
(
$response
[
'refresh_token'
])
?
$response
[
'refresh_token'
]
:
null
,
isset
(
$response
[
'refresh_token'
])
?
$response
[
'refresh_token'
]
:
$oldRefreshToken
,
isset
(
$response
[
'expires_in'
])
?
$response
[
'expires_in'
]
:
null
);
unset
(
$response
[
'access_token'
]);
...
...
Please
register
or
login
to post a comment