@@ -56,11 +56,11 @@ public function files()
5656 protected static $ baseUrl = 'https://graph.microsoft.com/v1.0/ ' ;
5757
5858 /**
59- * @return object
59+ * @return bool
6060 */
6161 public function isConnected ()
6262 {
63- return $ this ->getTokenData () == null ? false : true ;
63+ return !( $ this ->getTokenData () == null ) ;
6464 }
6565
6666 /**
@@ -84,8 +84,7 @@ public function connect()
8484 'scope ' => 'https://graph.microsoft.com/.default ' ,
8585 'client_id ' => config ('msgraph.clientId ' ),
8686 'client_secret ' => config ('msgraph.clientSecret ' ),
87- 'grant_type ' => 'client_credentials ' ,
88- 'resource ' => 'https://graph.microsoft.com ' ,
87+ 'grant_type ' => 'client_credentials '
8988 ];
9089
9190 $ token = $ this ->dopost (config ('msgraph.tenantUrlAccessToken ' ), $ params );
@@ -94,7 +93,7 @@ public function connect()
9493
9594 return redirect (config ('msgraph.msgraphLandingUri ' ));
9695 } catch (Exception $ e ) {
97- die ( ' error 90: ' . $ e ->getMessage ());
96+ throw new Exception ( $ e ->getMessage ());
9897 }
9998 }
10099 }
@@ -127,12 +126,10 @@ public function getAccessToken($returnNullNoAccessToken = null)
127126 // Token is expired (or very close to it) so let's refresh
128127
129128 $ params = [
130- 'grant_type ' => 'authorization_code ' ,
131129 'scope ' => 'https://graph.microsoft.com/.default ' ,
132130 'client_id ' => config ('msgraph.clientId ' ),
133131 'client_secret ' => config ('msgraph.clientSecret ' ),
134- 'grant_type ' => 'client_credentials ' ,
135- 'resource ' => 'https://graph.microsoft.com ' ,
132+ 'grant_type ' => 'client_credentials '
136133 ];
137134
138135 $ token = $ this ->dopost (config ('msgraph.tenantUrlAccessToken ' ), $ params );
@@ -232,7 +229,7 @@ protected function guzzle($type, $request, $data = [])
232229 } catch (ClientException $ e ) {
233230 return json_decode (($ e ->getResponse ()->getBody ()->getContents ()));
234231 } catch (Exception $ e ) {
235- return json_decode ($ e ->getResponse ()-> getBody ()-> getContents (), true );
232+ throw new Exception ($ e ->getMessage () );
236233 }
237234 }
238235
0 commit comments