@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'state' => $this->config['state'], |
31 | 31 | 'skip_confirm' => 1, |
32 | 32 | ]; |
33 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
33 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $data = json_decode($data, true); |
79 | 79 | |
80 | 80 | if (!isset($data['result']) || $data['result'] !== 'ok') { |
81 | - throw new OAuthException('获取小米用户信息失败:' . json_encode($data)); |
|
81 | + throw new OAuthException('获取小米用户信息失败:'.json_encode($data)); |
|
82 | 82 | } |
83 | 83 | return $data['data']; |
84 | 84 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | if (isset($data['access_token'])) { |
112 | 112 | return $data; |
113 | 113 | } |
114 | - throw new OAuthException('获取小米 access_token 出错:' . json_encode($data)); |
|
114 | + throw new OAuthException('获取小米 access_token 出错:'.json_encode($data)); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -109,7 +109,7 @@ |
||
109 | 109 | ]; |
110 | 110 | |
111 | 111 | $payload = $this->base64UrlEncode(json_encode($headers)) . '.' . |
112 | - $this->base64UrlEncode(json_encode($claims)); |
|
112 | + $this->base64UrlEncode(json_encode($claims)); |
|
113 | 113 | |
114 | 114 | openssl_sign($payload, $signature, $key, OPENSSL_ALGO_SHA256); |
115 | 115 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'response_mode' => 'form_post', |
29 | 29 | 'state' => $this->config['state'], |
30 | 30 | ]; |
31 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
31 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | 'sub' => $this->config['app_id'], |
109 | 109 | ]; |
110 | 110 | |
111 | - $payload = $this->base64UrlEncode(json_encode($headers)) . '.' . |
|
111 | + $payload = $this->base64UrlEncode(json_encode($headers)).'.'. |
|
112 | 112 | $this->base64UrlEncode(json_encode($claims)); |
113 | 113 | |
114 | 114 | openssl_sign($payload, $signature, $key, OPENSSL_ALGO_SHA256); |
115 | 115 | |
116 | - return $payload . '.' . $this->base64UrlEncode($signature); |
|
116 | + return $payload.'.'.$this->base64UrlEncode($signature); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -151,6 +151,6 @@ discard block |
||
151 | 151 | if (isset($data['access_token'])) { |
152 | 152 | return $data; |
153 | 153 | } |
154 | - throw new OAuthException('获取Apple access_token 出错:' . json_encode($data)); |
|
154 | + throw new OAuthException('获取Apple access_token 出错:'.json_encode($data)); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'state' => $this->config['state'], |
31 | 31 | 'response_mode' => 'query', |
32 | 32 | ]; |
33 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
33 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | $this->getToken(); |
71 | 71 | |
72 | 72 | $headers = [ |
73 | - 'Authorization: Bearer ' . $this->token['access_token'], |
|
73 | + 'Authorization: Bearer '.$this->token['access_token'], |
|
74 | 74 | ]; |
75 | 75 | |
76 | 76 | $data = $this->get($this->UserInfoURL, [], $headers); |
77 | 77 | $data = json_decode($data, true); |
78 | 78 | |
79 | 79 | if (!isset($data['id'])) { |
80 | - throw new OAuthException('获取Microsoft用户信息失败:' . json_encode($data)); |
|
80 | + throw new OAuthException('获取Microsoft用户信息失败:'.json_encode($data)); |
|
81 | 81 | } |
82 | 82 | return $data; |
83 | 83 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (isset($data['access_token'])) { |
113 | 113 | return $data; |
114 | 114 | } |
115 | - throw new OAuthException('获取Microsoft access_token 出错:' . json_encode($data)); |
|
115 | + throw new OAuthException('获取Microsoft access_token 出错:'.json_encode($data)); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | try { |
124 | 124 | $accessToken = $accessToken ?? $this->token['access_token']; |
125 | 125 | $headers = [ |
126 | - 'Authorization: Bearer ' . $accessToken, |
|
126 | + 'Authorization: Bearer '.$accessToken, |
|
127 | 127 | ]; |
128 | 128 | $data = $this->get($this->UserInfoURL, [], $headers); |
129 | 129 | $data = json_decode($data, true); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'state' => $this->config['state'] ?: '', |
31 | 31 | 'prompt' => 'consent' |
32 | 32 | ]; |
33 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
33 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $response = json_decode($response, true); |
95 | 95 | |
96 | 96 | if (!isset($response['accessToken'])) { |
97 | - throw new OAuthException('获取钉钉 access_token 出错:' . json_encode($response)); |
|
97 | + throw new OAuthException('获取钉钉 access_token 出错:'.json_encode($response)); |
|
98 | 98 | } |
99 | 99 | return $response; |
100 | 100 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'state' => $this->config['state'], |
31 | 31 | 'access_type' => 'offline', |
32 | 32 | ]; |
33 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
33 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $data = json_decode($data, true); |
80 | 80 | |
81 | 81 | if (!isset($data['displayName'])) { |
82 | - throw new OAuthException('获取华为用户信息失败:' . json_encode($data)); |
|
82 | + throw new OAuthException('获取华为用户信息失败:'.json_encode($data)); |
|
83 | 83 | } |
84 | 84 | return $data; |
85 | 85 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (isset($data['access_token'])) { |
113 | 113 | return $data; |
114 | 114 | } |
115 | - throw new OAuthException('获取华为 access_token 出错:' . json_encode($data)); |
|
115 | + throw new OAuthException('获取华为 access_token 出错:'.json_encode($data)); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 'scope' => $this->config['scope'] ?: 'user_info', |
30 | 30 | 'state' => $this->config['state'] ?: '', |
31 | 31 | ]; |
32 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
32 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $data = json_decode($data, true); |
79 | 79 | |
80 | 80 | if (!isset($data['result'])) { |
81 | - throw new OAuthException('获取快手用户信息失败:' . json_encode($data)); |
|
81 | + throw new OAuthException('获取快手用户信息失败:'.json_encode($data)); |
|
82 | 82 | } |
83 | 83 | return $data['result']; |
84 | 84 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $response = json_decode($response, true); |
100 | 100 | |
101 | 101 | if (!isset($response['access_token'])) { |
102 | - throw new OAuthException('获取快手 access_token 出错:' . json_encode($response)); |
|
102 | + throw new OAuthException('获取快手 access_token 出错:'.json_encode($response)); |
|
103 | 103 | } |
104 | 104 | return $response; |
105 | 105 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'redirect_uri' => $this->config['callback'], |
28 | 28 | 'state' => $this->config['state'] ?: '', |
29 | 29 | ]; |
30 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
30 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $data = json_decode($data, true); |
77 | 77 | |
78 | 78 | if (!isset($data['userid'])) { |
79 | - throw new OAuthException('获取企业微信用户信息失败:' . json_encode($data)); |
|
79 | + throw new OAuthException('获取企业微信用户信息失败:'.json_encode($data)); |
|
80 | 80 | } |
81 | 81 | return $data; |
82 | 82 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $response = json_decode($response, true); |
96 | 96 | |
97 | 97 | if (!isset($response['access_token'])) { |
98 | - throw new OAuthException('获取企业微信 access_token 出错:' . json_encode($response)); |
|
98 | + throw new OAuthException('获取企业微信 access_token 出错:'.json_encode($response)); |
|
99 | 99 | } |
100 | 100 | return $response; |
101 | 101 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ]; |
114 | 114 | $data = $this->get($this->UserInfoURL, $params); |
115 | 115 | $data = json_decode($data, true); |
116 | - return $data['errcode'] === 40029; // 无效的code但token有效 |
|
116 | + return $data['errcode'] === 40029; // 无效的code但token有效 |
|
117 | 117 | } catch (\Exception $e) { |
118 | 118 | return false; |
119 | 119 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'scope' => $this->config['scope'] ?: 'profile', |
29 | 29 | 'state' => $this->config['state'], |
30 | 30 | ]; |
31 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
31 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | $this->getToken(); |
69 | 69 | |
70 | 70 | $headers = [ |
71 | - 'Authorization: Bearer ' . $this->token['access_token'], |
|
71 | + 'Authorization: Bearer '.$this->token['access_token'], |
|
72 | 72 | ]; |
73 | 73 | |
74 | 74 | $data = $this->get($this->UserInfoURL, [], $headers); |
75 | 75 | $data = json_decode($data, true); |
76 | 76 | |
77 | 77 | if (!isset($data['user_id'])) { |
78 | - throw new OAuthException('获取Amazon用户信息失败:' . json_encode($data)); |
|
78 | + throw new OAuthException('获取Amazon用户信息失败:'.json_encode($data)); |
|
79 | 79 | } |
80 | 80 | return $data; |
81 | 81 | } |
@@ -108,6 +108,6 @@ discard block |
||
108 | 108 | if (isset($data['access_token'])) { |
109 | 109 | return $data; |
110 | 110 | } |
111 | - throw new OAuthException('获取Amazon access_token 出错:' . json_encode($data)); |
|
111 | + throw new OAuthException('获取Amazon access_token 出错:'.json_encode($data)); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 'state' => $this->config['state'], |
30 | 30 | 'nonce' => md5(uniqid()), |
31 | 31 | ]; |
32 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
32 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | $this->getToken(); |
70 | 70 | |
71 | 71 | $headers = [ |
72 | - 'Authorization: Bearer ' . $this->token['access_token'], |
|
72 | + 'Authorization: Bearer '.$this->token['access_token'], |
|
73 | 73 | ]; |
74 | 74 | |
75 | 75 | $data = $this->get($this->UserInfoURL, [], $headers); |
76 | 76 | $data = json_decode($data, true); |
77 | 77 | |
78 | 78 | if (!isset($data['sub'])) { |
79 | - throw new OAuthException('获取Yahoo用户信息失败:' . json_encode($data)); |
|
79 | + throw new OAuthException('获取Yahoo用户信息失败:'.json_encode($data)); |
|
80 | 80 | } |
81 | 81 | return $data; |
82 | 82 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | ]; |
97 | 97 | |
98 | 98 | $headers = [ |
99 | - 'Authorization: Basic ' . base64_encode($this->config['app_id'] . ':' . $this->config['app_secret']), |
|
99 | + 'Authorization: Basic '.base64_encode($this->config['app_id'].':'.$this->config['app_secret']), |
|
100 | 100 | 'Content-Type: application/x-www-form-urlencoded', |
101 | 101 | ]; |
102 | 102 | |
@@ -114,6 +114,6 @@ discard block |
||
114 | 114 | if (isset($data['access_token'])) { |
115 | 115 | return $data; |
116 | 116 | } |
117 | - throw new OAuthException('获取Yahoo access_token 出错:' . json_encode($data)); |
|
117 | + throw new OAuthException('获取Yahoo access_token 出错:'.json_encode($data)); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |