1414namespace Datamweb \ShieldOAuth \Libraries ;
1515
1616use Datamweb \ShieldOAuth \Libraries \Basic \AbstractOAuth ;
17+ use Exception ;
1718
1819class GoogleOAuth extends AbstractOAuth
1920{
@@ -22,24 +23,26 @@ class GoogleOAuth extends AbstractOAuth
2223 private static $ API_USER_INFO_URL = 'https://www.googleapis.com/oauth2/v3/userinfo ' ;
2324 private static $ APPLICATION_NAME = 'ShieldOAuth ' ;
2425 protected string $ token ;
26+ protected $ client ;
27+ protected $ config ;
2528 protected string $ client_id ;
2629 protected string $ client_secret ;
27- protected string $ callbake_url ;
30+ protected string $ callback_url ;
2831
2932 public function __construct (string $ token = '' )
3033 {
3134 $ this ->token = $ token ;
3235 $ this ->client = \Config \Services::curlrequest ();
3336
3437 $ this ->config = config ('ShieldOAuthConfig ' );
35- $ this ->callbake_url = base_url ('oauth/ ' . $ this ->config ->call_back_route );
38+ $ this ->callback_url = base_url ('oauth/ ' . $ this ->config ->call_back_route );
3639 $ this ->client_id = $ this ->config ->oauthConfigs ['google ' ]['client_id ' ];
3740 $ this ->client_secret = $ this ->config ->oauthConfigs ['google ' ]['client_secret ' ];
3841 }
3942
4043 public function makeGoLink (string $ state ): string
4144 {
42- return self ::$ API_CODE_URL . "?response_type=code&client_id= {$ this ->client_id }&scope=openid%20email%20profile&redirect_uri= {$ this ->callbake_url }&state= {$ state }" ;
45+ return self ::$ API_CODE_URL . "?response_type=code&client_id= {$ this ->client_id }&scope=openid%20email%20profile&redirect_uri= {$ this ->callback_url }&state= {$ state }" ;
4346 }
4447
4548 protected function fetchAccessTokenWithAuthCode (array $ allGet ): void
@@ -51,7 +54,7 @@ protected function fetchAccessTokenWithAuthCode(array $allGet): void
5154 'client_id ' => $ this ->client_id ,
5255 'client_secret ' => $ this ->client_secret ,
5356 'code ' => $ allGet ['code ' ],
54- 'redirect_uri ' => $ this ->callbake_url ,
57+ 'redirect_uri ' => $ this ->callback_url ,
5558 'grant_type ' => 'authorization_code ' ,
5659 ],
5760 'headers ' => [
0 commit comments