Permalink
Browse files

TwitterProvider(OAuth1) additional query string (#162)

* TwitterProvider(OAuth1) additional query string

TwitterProvider(Oauth1) doesn't compatible an additional query string regardless of having a method with().

Laracast discussion 'Is it possible to use force_login for Twitter in Laravel Socialite?'.
https://laracasts.com/discuss/channels/laravel/is-it-possible-to-use-force-login-for-twitter-in-laravel-socialite

I updating method getAuthorizationUrl().
It allows additional query strings like calling with(['fource_url'=>true]) options as well as ['lang' => 'ja'] option.

if 'SocialiteProviders\Manager\OAuth1\Server' add this function, It might be compatible any other OAuth1 providers.
Please review it. thx.

* Cord formatting.
  • Loading branch information...
tomothumb authored and faustbrian committed Apr 23, 2018
1 parent b10f7aa commit 9572f5851246919e26a34a2952a9b7ad2ab2fc3d
Showing with 21 additions and 0 deletions.
  1. +21 −0 Server.php
@@ -97,4 +97,25 @@ public function userScreenName($data, TokenCredentials $tokenCredentials)
{
return $data['screen_name'];
}
/**
* {@inheritdoc}
*/
public function getAuthorizationUrl($temporaryIdentifier)
{
// Somebody can pass through an instance of temporary
// credentials and we'll extract the identifier from there.
if ($temporaryIdentifier instanceof TemporaryCredentials) {
$temporaryIdentifier = $temporaryIdentifier->getIdentifier();
}
$query_oauth_token = ['oauth_token' => $temporaryIdentifier];
$parameters = (isset($this->parameters))
? array_merge($query_oauth_token, $this->parameters)
: $query_oauth_token;
$url = $this->urlAuthorization();
$queryString = http_build_query($parameters);
return $this->buildUrl($url, $queryString);
}
}

1 comment on commit 9572f58

@egorsgor

This comment has been minimized.

Copy link

egorsgor commented on 9572f58 Apr 25, 2018

Hi, this commit broke my authorization.

TemporaryCredentials is undefined class (need add use .. ) and for this reason $temporaryIdentifier is a object, http_build_query return empty string and i get this auth link: "https://api.twitter.com/oauth/authenticate?"

Please sign in to comment.