Provider – Twitter

Twitter Sample

Table of contents

How to enable Twitter login in WordPress


  • As of July 2018, you must apply for a Twitter developer account and be approved before you may create new apps. Once approved, you will be able to create new apps from developer.twitter.com.
  • Additionally the query string is no longer supported in the Callback URL, meaning that in the URL you must leave the ? and every other parameters which come after it.

To be able to log in via Twitter you must create a Twitter app first.

  1. Navigate to https://developer.twitter.com/en/portal/projects-and-apps
  2. Log in with your Twitter credentials if you are not logged in.
  3. If you don’t have a developer account yet, please apply one by filling all the required details! This is required for the next steps!
  4. Once your developer account is complete, navigate back to https://developer.twitter.com/en/portal/projects-and-apps if you aren’t already there!
  5. Choose the “Production” option for “App environment”, then press “Next”!
  6. Name your project, and go through the basic setup. You’ll need to select your use case, give a description then click the “Next” button.
  7. Choose the “Production” option for “App environment”, then press “Next”!
  8. Into the “App name” field, enter a name for your App, then press “Next” again!
  9. You’ll find your API key and secret on this page. Copy and paste the “API Key” and the “API Key Secret” to the corresponding fields at Nextend Social Login > Twitter > Settings and press “Save Changes”.
  10. Go back to your Twitter project and on the left side, under the “Projects & Apps” section click on the name of your App.
  11. Scroll down and click on the “Set up” button at “User authentication settings”.
  12. Switch on the “OAuth 1.0a” option.
  13. Into the “Callback URI / Redirect URL” field you should add the URL that Nextend Social Login suggests at the backend.
  14. Enter your site’s URL to the “Website URL” field.
  15. If you want to get the email address as well, then don’t forget to enable the “Request email from users (optional)” option. In this case you also need to fill the “Terms of service” and the “Privacy policy” fields with the corresponding URLs!
  16. Click on “Save”.
  17. On the left side, under the “Projects & Apps” section click on the name of your Project ( that you created the App for ).
  18. Click on the “Apply for Elevated” button, then fill the Basic info, Intended use, Review and Terms forms.
  19. Once your application for the Elevated access has been approved, go back to Nextend Social Login then verify and enable the Twitter provider!

Required Nextend Social Login settings for Twitter App

Once your Twitter app is ready you’ll need to copy and paste the API Key and API Key Secret to the Twitter provider’s Settings tab. You can find the information at your Twitter app’s Settings which you can reach from the left sidebar.

Verify the settings

Once your API Key and API Key Secret has been added you need to verify the setup first. This verification helps you identify possible problems with the app.

Settings

Twitter Provider Configuration

API Key

The API Key of your Twitter app. You can find it at your App → Keys and Access Tokens tab.

API Key Secret

The API Key Secret of your Twitter app. You can find it at your App → Keys and Access Tokens tab.

Twitter Other Settings

Username prefix on Register

Whenever a new user registers with their Twitter account they can get a custom prefix so you can easily identify them.

Fallback username prefix on register

Whenever a new user registers with their Twitter account and we can not generate a valid username from the first name or last name, a random username will be generated. With this option they can get a custom prefix so you can easily identify them.

Terms and conditions

This option can only be seen, if Terms and conditions is set to Show in Global Settings → Privacy tab. Here you can set custom Terms and Conditions for users who register with Twitter. For more information please read our GDPR documentation.

Profile image size

The avatar will be stored with the selected size.

Sync data

By default Nextend Social Login stores the first name, last name, email, avatar url and access token if it is possible, however some additional information can also be retrieved and stored.
When an option is checked, that field will be stored in a meta key with the specified name.

Twitter Sync Data

Sync fields

It determines when the synchronization shall happen.

  • Register: whenever a new user registers with a provider, their data will be retrieved and stored.
  • Login: whenever user logs in with a provider, their data will be retrieved and stored.
  • Link: whenever user links and existing WordPress account with a provider, their data will be retrieved and stored.

Bio

Stores the user’s bio.

Language

Stores the user’s language.

Location

Stores the user’s location.

Register date

Stores the date, when the Twitter account registration happened.

Profile URL

Stores the user’s Twitter profile URL.

Screen name

Stores the user’s screen name without the @ tag.

Owned website

Stores the user’s website.

Frequently Asked Questions

1. How can I get the email address from the Twitter users?

If your app is already set up, go to the Projects & Apps Overview page, find your App and click on the App settings icon ( the one that looks like a gear). Then click on the “Edit” button at the “Authentication settings” section and switch on the “Request email address from users” setting.
Important: If you ask the email address, you also need to fill the “Terms of service” and the “Privacy policy” fields with the corresponding URLs of your site!

Common error messages returned by Twitter during verification

Callback url has been locked

Error: Unexpected response: This client application’s callback url has been locked /oauth/request_token

The problem is that the value that was entered into the “Callback URI / Redirect URL” field is not correct for your app. Check the 13th step of the App setup to fix the problem.

oauth_callback value ‘oob’

Error: Unexpected response: Desktop applications only support the oauth_callback value ‘oob’ /oauth/request_token

The problem is that the value that was entered into the “Callback URI / Redirect URL” field is not correct for your app. Check the 13th step of the App setup to fix the problem.

Not a valid callback URL format

Error The client application failed validation: Not a valid callback URL format.

The problem is that the value that was entered into the “Callback URI / Redirect URL” field is not correct for your app or it may contain whitespace character. Check the 13th step of the App setup to fix the problem.

Could not authenticate you

Error: Could not authenticate you

The entered API Key is not correct. Maybe the app with the entered ID was deleted. Go to the Twitter provider → Settings and make sure that an existing App’s API Key and API Key Secret was entered.