Skip to content

Commit 2c073cf

Browse files
committed
redirect_uri
1 parent a0e9c74 commit 2c073cf

File tree

4 files changed

+41
-7
lines changed

4 files changed

+41
-7
lines changed

src/Discord/Endpoints/OAuth2Endpoint.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ private function get(
9898
$this->web_address,
9999
$this->http_port,
100100
$this->client_id,
101-
$this->client_secret,
102-
$scope = 'identify guilds connections',
101+
$this->client_secret
103102
);
104103
/** @var OAuth2Authenticator $OAA */
105104

src/Discord/OAuth2Authenticator.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ public function __construct(
3232
protected string $endpoint_name = 'dwa',
3333
protected string $scope = 'identify guilds connections'
3434
) {
35-
parent::__construct($request, $sessions, $resolved_ip, $web_address, $http_port, $client_id, $client_secret, $endpoint_name, $scope);
35+
parent::__construct(
36+
$request,
37+
$sessions,
38+
$resolved_ip,
39+
$web_address,
40+
$http_port,
41+
$client_id,
42+
$client_secret,
43+
$endpoint_name,
44+
$scope
45+
);
3646
}
3747

3848
/**

src/SS14/OAuth2Authenticator.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,28 @@ class OAuth2Authenticator extends __OAuth2Authenticator
1818
protected string $token_endpoint = '/connect/token';
1919
protected string $userinfo_endpoint = '/connect/userinfo';
2020
protected string $revocation_endpoint = '/connect/revocation';
21+
22+
public function __construct(
23+
$request,
24+
protected array &$sessions,
25+
string $resolved_ip,
26+
string $web_address,
27+
int $http_port,
28+
protected string $client_id,
29+
protected string $client_secret,
30+
protected string $endpoint_name = 'ss14wa',
31+
protected string $scope = 'openid profile email'
32+
) {
33+
parent::__construct(
34+
$request,
35+
$sessions,
36+
$resolved_ip,
37+
$web_address,
38+
$http_port,
39+
$client_id,
40+
$client_secret,
41+
$endpoint_name,
42+
$scope
43+
);
44+
}
2145
}

src/VerifierServer/OAuth2Authenticator.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ class OAuth2Authenticator
4141
* Initializes the OAuth2 authentication process by setting up session data,
4242
* request parameters, allowed URIs, and other necessary configurations.
4343
*
44+
* @param ServerRequestInterface $request
4445
* @param array &$sessions
4546
* @param string $resolved_ip
4647
* @param string $web_address
4748
* @param int $http_port
48-
* @param ServerRequestInterface $request
4949
* @param string $client_id
5050
* @param string $client_secret
5151
* @param string $endpoint_name
@@ -61,8 +61,8 @@ public function __construct(
6161
int $http_port,
6262
protected string $client_id,
6363
protected string $client_secret,
64-
protected string $endpoint_name = 'ss14wa',
65-
protected string $scope = 'openid profile email'
64+
protected string $endpoint_name,
65+
protected string $scope
6666
) {
6767
if (! $request instanceof ServerRequestInterface) {
6868
throw new \RuntimeException('String requests are not supported.');
@@ -134,8 +134,9 @@ public function login(
134134

135135
if (!in_array($redirect_uri = $redirect_uri ?? $this->default_redirect, $this->allowed_uri)) {
136136
$response = Response::STATUS_FOUND;
137-
$headers = ['Location' => $this->allowed_uri[0] . '?login'];
137+
$headers = ['Location' => "{$this->endpoint_name}/{$this->allowed_uri[0]}?login"];
138138
$body = '';
139+
var_dump($headers);
139140
return;
140141
}
141142

0 commit comments

Comments
 (0)