GenFirst / react-twitter-auth

A React Twitter Login Component
MIT License
93 stars 52 forks source link

add screen_name to popup url? #23

Open Serexx opened 6 years ago

Serexx commented 6 years ago

Hey - appreciate the work, saved me a lot of fiddling, just one request :-)

As per here: https://developer.twitter.com/en/docs/basics/authentication/api-reference/authenticate we would like pass a screen_name param to the popup URL to prefill the screen_name input.

I think, its just a matter of adding it to TwitterLogin.propTypes and appending it to the popup url like so

popup.location =https://api.twitter.com/oauth/authenticate?oauth_token=${data.oauth_token}&force_login=${this.props.forceLogin}&screen_name=${this.props.screenName||""};

if the property is not supplied the || or just passes the empty string, with no visible effect.

I'm going to clone it and give it a try (any reason I shouldn't ?) - if it works as expected do you want a pull request?

ivanvs commented 6 years ago

Hi @Serexx,

Great idea. I don't see any reason why we should not have this feature. I would be interested in PR. So go ahead!

alexandrtovmach commented 4 years ago

You can try this package, which return object like this:

{
  oauth_token: "abc"
  oauth_token_secret: "def"
  screen_name: "username"
  user_id: "1234"
}

And here you can find playground: https://alexandrtovmach.github.io/react-twitter-login/