[opw-web] Clarify error when refresh token is missing
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [opw-web] Clarify error when refresh token is missing
- Date: Tue, 29 Dec 2015 17:05:54 +0000 (UTC)
commit f6d3abe27a2fc49261047c267989c5df51600309
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Tue Dec 29 12:05:45 2015 -0500
Clarify error when refresh token is missing
auth/Hybrid/Provider_Model_OAuth2.php | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/auth/Hybrid/Provider_Model_OAuth2.php b/auth/Hybrid/Provider_Model_OAuth2.php
index 934b1aa..aaae805 100644
--- a/auth/Hybrid/Provider_Model_OAuth2.php
+++ b/auth/Hybrid/Provider_Model_OAuth2.php
@@ -138,10 +138,12 @@ class Hybrid_Provider_Model_OAuth2 extends Hybrid_Provider_Model
if( $this->api->access_token ){
// have to refresh?
- if( $this->api->refresh_token && $this->api->access_token_expires_at ){
-
+ if( $this->api->access_token_expires_at ) {
// expired?
- if( $this->api->access_token_expires_at <= time() ){
+ if( $this->api->access_token_expires_at <= time() ){
+ if( ! $this->api->refresh_token )
+ throw new Exception( "Expired access token but no refresh
token" );
+
$response = $this->api->refreshToken( array( "refresh_token" =>
$this->api->refresh_token ) );
if( ! isset( $response->access_token ) || ! $response->access_token ){
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]