Twitter Social Identity Provider

Set Up Twitter

To set up Twitter as a social identity provider, navigate to the following page: Single-user OAuth with Examples . You'll need a Twitter account. You can then navigate to the Twitter Application Management page, where you can select Create New App and enter at least the following information:

  • Name

  • Description

  • Website, such as http://openidm.example.com:8080

  • Callback URL, such as http://openidm.example.com:8080/; required for IDM; for other providers, known as RedirectURI

When complete and saved, you should see a Consumer Key and Consumer Secret for your new web app.

Note

Twitter Apps use the OAuth 1.0a protocol. Fortunately, with IDM, you can use the same process used to configure OIDC and OAuth 2 social identity providers.

Configure Twitter as a Social Identity Provider

  1. To configure Twitter as a social identity provider, log in to the Admin UI and navigate to Configure > Social ID Providers.

  2. Enable the Twitter social identity provider.

    In the Twitter Provider pop-up that appears, the values for Callback URL should use the same value shown in "Set Up Twitter".

  3. Include the values that Twitter created for Consumer Key and Consumer Secret, as described in "Set Up Twitter".

  4. Under regular and Advanced Options, if necessary, include the options shown in the following appendix: "Twitter Social Identity Provider Configuration Details".

When you enable a Twitter social identity provider in the Admin UI, IDM generates the identityProvider-twitter.json file in your project's conf/ subdirectory.

When you review that file, you should see information beyond what you see in the Admin UI. The first part of the file includes the name of the provider, endpoints, as well as information from the Consumer Key and Consumer Secret, you'll see them as clientId and clientSecret, respectively, in the configuration file.

{
    "provider" : "twitter",
    "requestTokenEndpoint" : "https://api.twitter.com/oauth/request_token",
    "authorizationEndpoint" : "https://api.twitter.com/oauth/authenticate",
    "tokenEndpoint" : "https://api.twitter.com/oauth/access_token",
    "userInfoEndpoint" : "https://api.twitter.com/1.1/account/verify_credentials.json",
    "clientId" : "<Client_ID_Name>",
    "clientSecret" : {
      "$crypto" : {
          "type" : "x-simple-encryption",
          "value" : {
              "cipher" : "AES/CBC/PKCS5Padding",
              "stableId" : "openidm-sym-default",
              "salt" : "<hashValue>",
              "data" : "<encryptedValue>",
              "keySize" : 16,
              "purpose" : "idm.config.encryption",
              "iv" : "<encryptedValue>",
              "mac" : "<hashValue>"
          }
      }
    },

You should also see UI settings related to the social identity provider icon (badge) and the sign-in button, described in "Social Identity Provider Button and Badge Properties".

You'll see links related to the authenticationIdKey, redirectUri, and configClass.

The next part of the file includes schema information, which includes properties for each social identity account, as collected by IDM, as well as the order in which it appears in the Admin UI. When you've registered a user with a Twitter social identity, you can verify this by selecting Manage > Twitter, and then selecting a user.

Another part of the file includes a propertyMap, which maps user information entries between the source (social identity provider) and the target (IDM).

If you need more information about the properties in this file, refer to the following appendix: "Twitter Social Identity Provider Configuration Details".

Configure User Registration to Link to Twitter

Once you've configured the Twitter social identity provider, you can activate it through User Registration. To do so in the Admin UI, select Configure > User Registration, and activate that feature. Under the Social tab that appears, enable Social Registration. For more information on IDM user self-service features, see "Self-Service End User UI".

When you enable Social Registration, you're allowing users to register on IDM through all active social identity providers.

Twitter Social Identity Provider Configuration Details

You can set up the Twitter social identity provider through the Admin UI or in a conf/identityProvider-twitter.json file. IDM generates the identityProvider-twitter.json file when you configure and enable the Twitter social identity provider in the Admin UI. Alternatively, you can create that file manually.

The following table includes the information shown in the Admin UI Twitter Provider pop-up window, along with associated information in the identityProvider-twitter.json file.

Twitter Social Identity Provider Configuration Properties
Property (UI)Property (JSON file)Description
Consumer KeyclientIdThe client identifier for your Twitter App
Consumer SecretclientSecretUsed with the Client ID to access the applicable Twitter API
Authorization EndpointauthorizationEndpointTypically https://api.twitter.com/oauth/authenticate; known as a Twitter Authorize URL
Access Token EndpointtokenEndpointEndpoint that receives a one-time authorization code, and returns an access token; typically https://api.twitter.com/oauth/access_token
User Info EndpointuserInfoEndpointAccess for other URIs; typically https://api.twitter.com/1.1/account/verify_credentials.json
Request Token EndpointrequestTokenEndpointEndpoint that receives a one-time authorization code, and returns an access token; typically https://api.twitter.com/oauth/request_token
Not in the Admin UIproviderName of the social identity provider
Not in the Admin UIauthenticationIdKeyThe user identity property, such as _id
Not in the Admin UIconfigClassConfiguration class for the authentication module
Not in the Admin UIbasicAuthWhether to use basic authentication
Not in the Admin UIpropertyMapMapping between Twitter and IDM

For information on social identity provider buttons and badges, see "Social Identity Provider Button and Badge Properties".

Read a different version of :