knpuniversity / oauth2-client-bundle

Easily talk to an OAuth2 server for social functionality in Symfony
https://symfonycasts.com
MIT License
787 stars 145 forks source link

Azure: Firebase\JWT\JWT::getKey(): Return value must be of type Firebase\JWT\Key, string returned #371

Closed pps1 closed 2 years ago

pps1 commented 2 years ago

I receive the following error when using the Azure AD client adapter in a Symfony 5.4 application:

Screen Shot 2022-06-23 at 10 14 10

Authenticator code snippet:

class AzureAuthenticator extends OAuth2Authenticator
{
    use LoggableTrait;

    public function __construct(
        private ClientRegistry $clientRegistry,
        private EntityManagerInterface $entityManager,
        private RouterInterface $router,
        private ?LoggerInterface $logger
    ) {
    }

   //...

    public function authenticate(Request $request): Passport
    {
        $client = $this->clientRegistry->getClient('azure');
        /** @var AccessToken $accessToken */
        $accessToken = $this->fetchAccessToken($client);
        $tokenString = $accessToken->getToken();

        //...
}

Config:

knpu_oauth2_client:
    clients:
        # will create service: "knpu.oauth2.client.azure"
        # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\AzureClient
        # composer require thenetworg/oauth2-azure
        azure:
            type: azure
            client_id: '%env(OAUTH_AZURE_CLIENT_ID)%'
            client_secret: '%env(OAUTH_AZURE_CLIENT_SECRET)%'
            tenant: '%env(OAUTH_AZURE_TENANT)%' # common, organizations, consumers, or tenant id
            redirect_route: login_azure_check
            redirect_params: { }
            use_state: false
            scope:
                - openid
                - email
                - profile

Versions:

Symfony 5.4.9
knpuniversity/oauth2-client-bundle     v2.10.1
thenetworg/oauth2-azure                v2.1.0
firebase/php-jwt                       v6.2.0

Any thoughts on what I may be doing wrong here? Thank you!

pps1 commented 2 years ago

This is a duplicate of https://github.com/TheNetworg/oauth2-azure/issues/161