File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616class Provider
1717{
1818 /**
19- * @var AccessToken|null
19+ * @var AccessToken[]
2020 */
21- protected static $ token ;
21+ protected static $ tokens ;
2222 /**
2323 * @var int
2424 */
@@ -89,17 +89,17 @@ public function getAccessToken()
8989 {
9090 $ provider = $ this ->getProvider ();
9191
92- if (!self ::$ token instanceof AccessToken || self ::$ token ->hasExpired ()) {
92+ if (!is_array ( self ::$ tokens ) || ! array_key_exists ( $ provider -> companyId , self :: $ tokens ) || ! self :: $ tokens [ $ provider -> companyId ] instanceof AccessToken || self ::$ tokens [ $ provider -> companyId ] ->hasExpired ()) {
9393 try {
94- self ::$ token = $ provider ->getAccessToken ('client_credentials ' , ['scope ' => $ this ->scopes ]);
94+ self ::$ tokens [ $ provider -> companyId ] = $ provider ->getAccessToken ('client_credentials ' , ['scope ' => $ this ->scopes ]);
9595 } catch (IdentityProviderException $ e ) {
9696 throw new AuthenticationException ($ e ->getMessage (), $ e ->getCode ());
9797 } catch (ConnectException $ e ) {
9898 throw new CurlException ($ e ->getMessage (), $ e ->getCode ());
9999 }
100100 }
101101
102- return self ::$ token ->getToken ();
102+ return self ::$ tokens [ $ provider -> companyId ] ->getToken ();
103103 }
104104
105105 /**
You can’t perform that action at this time.
0 commit comments