How to Add a Login with a Twitter Button

Download the Twitter OAuth package which you will be using to set up the login using a Twitter button., Import the TwitterOAuth class onto your page and initialize the connection., Create a Twitter App on the Twitter dev site at...

11 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: Download the Twitter OAuth package which you will be using to set up the login using a Twitter button.

    Go to https://github.com/abraham/twitteroauth for the import. , This will service the requests for the Twitter social login for your site. , <Consumer Secret>
    - The Consumer Secret found in the created app found under Keys and Access Tokens. <Callback Location>
    - The URL that you would like a user to return to after successfully authenticating. , From the response object capture the “oauth_token” and “oauth_token_secret” for further use. ,, Once a user has successfully authenticated they will be redirected to the location that you specified in the request_token OAUTH_CALLBACK URL. ,,,, At this point your user is logged in and you can make calls to the Twitter social login APIs.You have successfully set a login using Twitter on your page!
  2. Step 2: Import the TwitterOAuth class onto your page and initialize the connection.

  3. Step 3: Create a Twitter App on the Twitter dev site at https://dev.twitter.com/.

  4. Step 4: Replace the above definitions with the following details from your App: <Consumer Key> - The Consumer Key found in the created app found under Keys and Access Tokens.

  5. Step 5: Generate a Request token that will be used to generate a URL which will trigger the Twitter Authentication popup.

  6. Step 6: Generate the URL to be used to display the Twitter social login Authentication interface.

  7. Step 7: Set up a button or trigger to cause users to navigate to the URL which will display the Twitter social login interface.

  8. Step 8: On your Callback page

  9. Step 9: import the TwitterOAuth class again.

  10. Step 10: Initialize the connection using the stored “oauth_token” and “oauth_token_secret”.

  11. Step 11: Request an access_token to be used to access user data and actions.

Detailed Guide

Go to https://github.com/abraham/twitteroauth for the import. , This will service the requests for the Twitter social login for your site. , <Consumer Secret>
- The Consumer Secret found in the created app found under Keys and Access Tokens. <Callback Location>
- The URL that you would like a user to return to after successfully authenticating. , From the response object capture the “oauth_token” and “oauth_token_secret” for further use. ,, Once a user has successfully authenticated they will be redirected to the location that you specified in the request_token OAUTH_CALLBACK URL. ,,,, At this point your user is logged in and you can make calls to the Twitter social login APIs.You have successfully set a login using Twitter on your page!

About the Author

K

Kathryn Harvey

Committed to making DIY projects accessible and understandable for everyone.

73 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: