Skip to content

Commit bf476c0

Browse files
authored
fix(auth): invalid key file arguments for Apple OAuth provider (#1640)
1 parent ca8e6ee commit bf476c0

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

packages/auth/src/OAuth/Config/AppleOAuthConfig.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public function createProvider(): AbstractProvider
6060
return new Apple([
6161
'clientId' => $this->clientId,
6262
'teamId' => $this->teamId,
63-
'keyId' => $this->keyId,
64-
'keyFile' => $this->keyFile,
63+
'keyFileId' => $this->keyId,
64+
'keyFilePath' => $this->keyFile,
6565
]);
6666
}
6767

packages/auth/tests/OAuthTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Tempest\Auth\Tests;
66

7+
use League\OAuth2\Client\Provider\Apple;
78
use League\OAuth2\Client\Provider\Facebook;
89
use League\OAuth2\Client\Provider\Github;
910
use League\OAuth2\Client\Provider\Google;
@@ -12,6 +13,7 @@
1213
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
1314
use PHPUnit\Framework\Attributes\Test;
1415
use PHPUnit\Framework\TestCase;
16+
use Tempest\Auth\OAuth\Config\AppleOAuthConfig;
1517
use Tempest\Auth\OAuth\Config\DiscordOAuthConfig;
1618
use Tempest\Auth\OAuth\Config\FacebookOAuthConfig;
1719
use Tempest\Auth\OAuth\Config\GenericOAuthConfig;
@@ -143,6 +145,26 @@ public function discord_oauth_config(): void
143145
$this->assertStringContainsString('discord-123', $url);
144146
}
145147

148+
#[Test]
149+
public function apple_oauth_config(): void
150+
{
151+
$config = new AppleOAuthConfig(
152+
clientId: 'apple-123',
153+
teamId: 'apple-team-id',
154+
keyId: 'apple-key-id',
155+
keyFile: 'apple-key-file',
156+
redirectTo: '/auth/apple/callback',
157+
scopes: ['email', 'name'],
158+
);
159+
160+
$provider = $config->createProvider();
161+
$url = $provider->getAuthorizationUrl();
162+
163+
$this->assertInstanceOf(Apple::class, $provider);
164+
$this->assertStringContainsString('apple.com', $url);
165+
$this->assertStringContainsString('apple-123', $url);
166+
}
167+
146168
#[Test]
147169
public function oauth_user_creation(): void
148170
{

0 commit comments

Comments
 (0)