Skip to content

Overriding config does not work for oauth1 providers #207

@Coding-Kiwi

Description

@Coding-Kiwi

Issue / Motivation:

"laravel/socialite": "^5.5"
"socialiteproviders/trello": "^4.1"

As specified in the documentation, you can override the config like this:

$config = new \SocialiteProviders\Manager\Config($clientId, $clientSecret, $redirectUrl, $additionalProviderConfig);
return Socialite::driver('trello')->setConfig($config)->redirect();

Sadly setConfig specified in https://github.com/SocialiteProviders/Manager/blob/master/src/OAuth1/AbstractProvider.php#L149 does only modify the config object, but not the clientCredentials (League\OAuth1\Client\Credentials\ClientCredentialsInterface) inside the server (League\OAuth1\Client\Server\Server)

Expected behavior:

Calling setConfig changes the config of the provider that is later on used by the redirect call

Actual behavior:

Calling setConfig leaves the values inside the OAuth1 Server instance (which seem to be the values that are actually used by
the redirect call) untouched

Steps to reproduce the behavior:

  1. install socialiteproviders/trello
  2. try to assign a new config with different redirect uri for example
  3. redirect call still uses the values from config.php

Proposed solution:

Pseudocode:

#SocialiteProviders\Manager\OAuth1\AbstractProvider

public function setConfig(Config $config){
      $this->config = $this->server->setConfig($config);

      if($this->server instanceof League\OAuth1\Client\Server\Server){
            $credentials = $this->server->getClientCredentials();
            $credentials->setIdentifier($config->get()["client_id"]);
            $credentials->setSecret($config->get()["client_secret"]);
            $credentials->setCallbackUri($config->get()["redirect"]);
      }

      return $this;
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions