Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #363 from saloonphp/fix/allow-create-oauth-authent…
…icator-refresh-to-be-nullable

Fix | Allow createOAuthAuthenticator method to have a nullable refresh token
  • Loading branch information
Sammyjo20 committed Jan 18, 2024
2 parents 3222ff8 + dd2f671 commit e956c73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Traits/OAuth2/AuthorizationCodeGrant.php
Expand Up @@ -161,7 +161,7 @@ protected function createOAuthAuthenticatorFromResponse(Response $response, stri
/**
* Create the authenticator.
*/
protected function createOAuthAuthenticator(string $accessToken, string $refreshToken, ?DateTimeImmutable $expiresAt = null): OAuthAuthenticator
protected function createOAuthAuthenticator(string $accessToken, ?string $refreshToken = null, ?DateTimeImmutable $expiresAt = null): OAuthAuthenticator
{
return new AccessTokenAuthenticator($accessToken, $refreshToken, $expiresAt);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Fixtures/Connectors/CustomResponseOAuth2Connector.php
Expand Up @@ -15,7 +15,7 @@ class CustomResponseOAuth2Connector extends Connector
{
use AuthorizationCodeGrant;


public function __construct(protected string $greeting)
{
//
Expand All @@ -41,9 +41,9 @@ protected function defaultOauthConfig(): OAuthConfig
}

/**
* Define a custom OAuth2 authenticator.
* Create the OAuth authenticator
*/
protected function createOAuthAuthenticator(string $accessToken, string $refreshToken, DateTimeImmutable $expiresAt): OAuthAuthenticator
protected function createOAuthAuthenticator(string $accessToken, ?string $refreshToken = null, ?DateTimeImmutable $expiresAt = null): OAuthAuthenticator
{
return new CustomOAuthAuthenticator($accessToken, $this->greeting, $refreshToken, $expiresAt);
}
Expand Down

0 comments on commit e956c73

Please sign in to comment.