Skip to content

Commit

Permalink
Update OAuth2 base authorization URL (#44)
Browse files Browse the repository at this point in the history
* Update OAuth2 base authorization URL
* Fix authorization and access token tests

This has been caused by #39 which did not appropriately update
the authorization and access token URL tests in the same way as #33
  • Loading branch information
ShawnCZek authored Dec 29, 2022
1 parent f87a293 commit 2df4d2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/Provider/Discord.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ class Discord extends AbstractProvider
use BearerAuthorizationTrait;

/**
* API Domain
* Default host
*
* @var string
*/
public $host = 'https://discord.com';

/**
* API domain
*
* @var string
*/
Expand All @@ -39,7 +46,7 @@ class Discord extends AbstractProvider
*/
public function getBaseAuthorizationUrl()
{
return $this->apiDomain.'/oauth2/authorize';
return $this->host.'/oauth2/authorize';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/src/Provider/DiscordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testGetAuthorizationUrl()
$url = $this->provider->getAuthorizationUrl();
$uri = parse_url($url);

$this->assertEquals('/api/oauth2/authorize', $uri['path']);
$this->assertEquals('/oauth2/authorize', $uri['path']);
}

public function testGetBaseAccessTokenUrl()
Expand All @@ -64,7 +64,7 @@ public function testGetBaseAccessTokenUrl()
$url = $this->provider->getBaseAccessTokenUrl($params);
$uri = parse_url($url);

$this->assertEquals('/api/oauth2/token', $uri['path']);
$this->assertEquals('/api/v9/oauth2/token', $uri['path']);
}

public function testGetAccessToken()
Expand Down

0 comments on commit 2df4d2a

Please sign in to comment.