Skip to content

Commit 01de7b1

Browse files
authored
Merge pull request #36 from sammyskills/fix-typo
Fix variable typo
2 parents 4da6cdf + 330d9a7 commit 01de7b1

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

docs/add_other_oauth.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ declare(strict_types=1);
3737
namespace App\Libraries\ShieldOAuth;
3838

3939
use Datamweb\ShieldOAuth\Libraries\Basic\AbstractOAuth;
40+
use Exception;
4041

4142
class YahooOAuth extends AbstractOAuth
4243
{
@@ -47,24 +48,26 @@ class YahooOAuth extends AbstractOAuth
4748
static private $APPLICATION_NAME = 'ShieldOAuth';
4849

4950
protected string $token;
51+
protected $client;
52+
protected $config;
5053
protected string $client_id;
5154
protected string $client_secret;
52-
protected string $callbake_url;
55+
protected string $callback_url;
5356

5457
public function __construct(string $token = '')
5558
{
5659
$this->token = $token;
5760
$this->client = \Config\Services::curlrequest();
5861

5962
$this->config = config('ShieldOAuthConfig');
60-
$this->callbake_url = base_url('oauth/' . $this->config->call_back_route);
63+
$this->callback_url = base_url('oauth/' . $this->config->call_back_route);
6164
$this->client_id = $this->config->oauthConfigs['yahoo']['client_id'];
6265
$this->client_secret = $this->config->oauthConfigs['yahoo']['client_secret'];
6366
}
6467

6568
public function makeGoLink(string $state): string
6669
{
67-
$yahooURL= self::$API_CODE_URL."?response_type=code&client_id={$this->client_id}&redirect_uri={$this->callbake_url}&state={$state}";
70+
$yahooURL= self::$API_CODE_URL."?response_type=code&client_id={$this->client_id}&redirect_uri={$this->callback_url}&state={$state}";
6871

6972
return $yahooURL;
7073
}
@@ -79,7 +82,7 @@ class YahooOAuth extends AbstractOAuth
7982
'form_params' => [
8083
'client_id' => $this->client_id ,
8184
'client_secret' => $this->client_secret ,
82-
'redirect_uri' => $this->callbake_url,
85+
'redirect_uri' => $this->callback_url,
8386
'code' => $allGet['code'],
8487
'grant_type' => 'authorization_code'
8588
],

src/Libraries/GithubOAuth.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace Datamweb\ShieldOAuth\Libraries;
1515

1616
use Datamweb\ShieldOAuth\Libraries\Basic\AbstractOAuth;
17+
use Exception;
1718

1819
class GithubOAuth extends AbstractOAuth
1920
{
@@ -22,21 +23,26 @@ class GithubOAuth extends AbstractOAuth
2223
public static $API_USER_INFO_URL = 'https://api.github.com/user';
2324
private static $APPLICATION_NAME = 'ShieldOAuth';
2425
protected string $token;
26+
protected $client;
27+
protected $config;
28+
protected string $client_id;
29+
protected string $client_secret;
30+
protected string $callback_url;
2531

2632
public function __construct(string $token = '')
2733
{
2834
$this->token = $token;
2935
$this->client = \Config\Services::curlrequest();
3036

3137
$this->config = config('ShieldOAuthConfig');
32-
$this->callbake_url = base_url('oauth/' . $this->config->call_back_route);
38+
$this->callback_url = base_url('oauth/' . $this->config->call_back_route);
3339
$this->client_id = $this->config->oauthConfigs['github']['client_id'];
3440
$this->client_secret = $this->config->oauthConfigs['github']['client_secret'];
3541
}
3642

3743
public function makeGoLink(string $state): string
3844
{
39-
return $redirectUrl = self::$API_CODE_URL . "?client_id={$this->client_id}&redirect_uri={$this->callbake_url}&scope=user%3Aemail&response_type=code&state={$state}";
45+
return $redirectUrl = self::$API_CODE_URL . "?client_id={$this->client_id}&redirect_uri={$this->callback_url}&scope=user%3Aemail&response_type=code&state={$state}";
4046
}
4147

4248
protected function fetchAccessTokenWithAuthCode(array $allGet): void
@@ -48,7 +54,7 @@ protected function fetchAccessTokenWithAuthCode(array $allGet): void
4854
'client_id' => $this->client_id,
4955
'client_secret' => $this->client_secret,
5056
'code' => $allGet['code'],
51-
'redirect_uri' => $this->callbake_url,
57+
'redirect_uri' => $this->callback_url,
5258
'grant_type' => 'authorization_code',
5359
],
5460
'headers' => [

src/Libraries/GoogleOAuth.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace Datamweb\ShieldOAuth\Libraries;
1515

1616
use Datamweb\ShieldOAuth\Libraries\Basic\AbstractOAuth;
17+
use Exception;
1718

1819
class 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

Comments
 (0)