Skip to main content

Twitter Authentication

info

We’re currently making rapid changes to the product so our docs may be out of date. If you need help, please email yo@forem.com.

Forem allows you to authenticate using Twitter. In order to use this authentication method in local development, you will need to setup a Twitter App and retrieve its keys. Then you'll need to provide these keys to the Rails application.

Sign up

  1. Sign in to your Twitter account.

  2. In order to get the API keys, you will have to apply for a developer account. Click the Apply button.

    Apply for developer account

  3. Setup your Twitter account. Be sure you have your phone number and email address filled in.

    Set up Twitter account

  4. Fill in your account information and give a name to your developer account.

    Fill in your account information

  5. Write down the reasons that you want to use Twitter API. Mention Forem's community and describe the issues and tests and things that you want to work on. Copy it, you might use it later. ;)

    twitter-up-4

  6. Read :) and accept the Terms and Conditions.

    twitter-up-5

  7. Verify your email address once more, and you will be done.

  8. You are done.

Get API keys

  1. Sign up or sign in to your Twitter developer account.

  2. From Apps dashboard, click on Create and app.

    Click Create and app

  3. Fill in the app name, description, and URL https://dev.to.

    Add name, description, and URL

  4. Check the Enable Sign in with Twitter option and fill in the Callback URL http://localhost:3000/users/auth/twitter/callback (or whatever port you run Forem on).

    Enable sign-in

  5. Fill in the information, Terms of Service http://dev.to/terms and Privacy policy http://dev.to/privacy.

    Agree to terms and privacy

  6. Write down (or paste) the things that you will work on. Press Create.

    Describe what you will work on

  7. Review the Twitter Developer Terms and agree to do nothing sketchy.

    Agree to Developer Terms

  8. The app is all set!

  9. One more change: From the app dashboard, go to Permissions and check Request email addresses from users option.

    check Request email addresses from users

  10. From the same dashboard access the Keys and tokens and add them to your .env file accordingly (name of Twitter key -> name of our ENV variable). Be sure to copy the access token and access token secret right away because it will be hidden from you in the future.

    API key -> TWITTER_KEY
    API secret key -> TWITTER_SECRET

    Add Twitter Key and Secret to .env file