thephpleague / oauth2-client

Easy integration with OAuth 2.0 service providers.

Home Page:http://oauth2-client.thephpleague.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Getter method "getResourceOwnerDetailsUrl" needs access token parameter, but it is not used.

phprogramer opened this issue · comments

Hello,

First of all, thank you for an amazing work! I have a question, that I was not able to find answer for. I am using GenericProvider, and I need to get urlResourceOwnerDetails. As i can see there is a public getter method, but it requires AccessToken $token parameter, which is not being used in that method. My question is - why there is a required AccessToken parameter that is not used, and how should I get urlResourceOwnerDetails when I do not have AccessToken instance.

You must provide the ResourceOwnerDetailsUrl. The generic provider does not know about your environment unless you tell it.

    /**
     * Returns all options that are required.
     *
     * @return array
     */
    protected function getRequiredOptions()
    {
        return [
            'urlAuthorize',
            'urlAccessToken',
            'urlResourceOwnerDetails', // <--- YOU PROVIDE THIS
        ];
    }

You must pass in this value when configuring your GenericProvider instance.

$provider = new League\OAuth2\Client\Provider\GenericProvider([
    'urlResourceOwnerDetails' => 'https://xxxxxxxxx',
    ...
]);

Thanks for helping out, @cloudcogsio !