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/apps/create
  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/apps/create if you aren’t already there!
  5. Fill the App name, Application description fields. Then enter your site’s URL to the Website field – it also appears on the Getting Started page of Twitter Provider. For example: https://yoursite.com
  6. Tick the checkbox next to Enable Sign in with Twitter!
  7. Add the following URL to the “Callback URL” field: https://yoursite.com/wp-login.php where yoursite.com is your site’s URL. ( The /wp-login.php can change to a slug of a page if you have selected one for OAuth redirect uri proxy page in Global Settings>General )
  8. Fill the “Terms of Service URL, Privacy policy URL and Tell us how this app will be used” fields!
  9. Click the Create button.
  10. Read the Developer Terms and click the Create button again!
  11. Select the Permissions tab click Edit.
  12. Tick the Request email address from users under the Additional permissions section and click Save.
  13. Go to the Keys and tokens tab and find the API key and API secret key

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 Secret key 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 Secret key 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 Secret key

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

Twitter Provider Configuration

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.

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?

After you set up your APP go to the Settings tab and enter the URL of your Terms of Service and Privacy Policy page. Then hit the Update your settings button.
Twitter App - Get User Email
Then go to the Permissions tab and check the “Request email addresses from users” under “Additional Permissions”.

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 entered Callback URL field is not correct for your app. Check the 7th 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 entered Callback URL field is not correct for your app. Check the 7th 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 entered Callback URL field is not correct for your app or it may contain whitespace character. Check the 7th 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 Secret key was entered.