src/RestGalleries/Auth/Auth.php
public static function connect(array $clientCredentials, array $endPoints, $userDataUrl)
    {
        $instance = new static;

        if (! $instance->protocol = self::getAuthProtocol($clientCredentials)) {
            throw new \InvalidArgumentException('Credential keys are invalid.');
        }

        $instance->credentials = $clientCredentials;
        $instance->endPoints   = $endPoints;
        $tokenCredentials      = $instance->fetchTokenCredentials();

        $instance->addToCredentials($tokenCredentials);
        $instance->filterCredentialsByKey('token_credentials');

        return $instance->fetchUserData($userDataUrl);

    }
public static function connect(array $clientCredentials, array $endPoints, $userDataUrl)
    {
        $instance = new static;

        if (! $instance->protocol = self::getAuthProtocol($clientCredentials)) {
            throw new \InvalidArgumentException('Credential keys are invalid.');
        }

        $instance->credentials = $clientCredentials;
        $instance->endPoints   = $endPoints;
        $tokenCredentials      = $instance->fetchTokenCredentials();

        $instance->addToCredentials($tokenCredentials);
        $instance->filterCredentialsByKey('token_credentials');

        return $instance->fetchUserData($userDataUrl);

    }
Takes credentials and URLs, checks credentials and gets tokens.
Returns an account with their credentials.

@param  array  $clientCredentials
@param  array  $endPoints
@param  string $userDataUrl
@return object