// Module included in the following assemblies:
// Upstream:
// tutorials/topics/as_t2sf-intro.adoc
// connecting/topics/as_connecting-to-twitter.adoc
// Downstream:
// fuse-online-sample-integration-tutorials/upstream/as_t2sf-intro.adoc
// connecting-fuse-online-to-applications-and-services/upstream/as_connecting-to-twitter.adoc

[id='register-with-twitter_{context}']
= Registering {prodname} as a Twitter client application

In an integration, to connect to Twitter, the first thing you must do is
register your {prodname} environment as a client application
that can access Twitter.
This lets you create any number of integrations that connect
to Twitter. In other words, you need to register a particular
{prodname} environment with Twitter only once.

In each {prodname} environment, there can be only one registration
of {prodname} as a Twitter client application. However, while each Twitter
connection uses the same registration, it can use different user
credentials. 

.Prerequisite
You are logged in to {prodname}. 

.Procedure

. In {prodname}:
.. In the left panel, click *Settings*.
.. On the *Settings* page, near the top, to the right of the callback URL, click 
image:images/tutorials/CopyCallback.png[Copy Callback URL] to 
copy the callback URL for your installation of {prodname} to the clipboard. 
You will need this URL later in this procedure. 
.. Click the *Twitter* entry 
to display the *Consumer API Key* and *Consumer API Secret Key* fields.
. In another browser tab, go to your
https://developer.twitter.com/apps[Twitter developer account], sign in if you
need to, and then do the following: 
.. Click *Projects & Apps*.
.. On the *Overview* page, scroll down to *STandalone Apps* and then click *Create App*. 
.. In the *App name* field, enter a name such as *My {prodname} Client*. 
.. Scroll down to *Setup Your App* and then click *App settings*.
.. Scroll down to *User authentication settings*, click *Set up*.
.. Switch on the *OAuth 1.0a* option.
.. For *App permissions*, select *Read and write and Direct message*.
.. In the *Callback URLs* field, paste the URL that you copied at the beginning
of this procedure. It should be something like this: 
`\https://app-proj912876.7b63.{prodnameinurl}.openshiftapps.com/api/v1/credentials/callback`
.. In the *Website URL* field, paste the URL again and remove `/api/v1/credentials/callback` from the end of the URL.
+
You can skip the next few fields.
.. Click *Save*.
.. At the top of the page for the app that you just created, click 
the *Keys and tokens* tab. 
.. Under *Consumer Keys*, click *Regenerate* and then verify that you want to regenerate them.
.. Copy the API key. 
. Return to your {prodname} *Settings* page and paste the Twitter
consumer API key into the {prodname} Twitter *Consumer API Key* field.
. Return to the Twitter *Keys and tokens* tab and copy the consumer API secret key. 
. Return to your {prodname} *Settings* page and paste the Twitter
consumer API secret key into the {prodname} Twitter
*Consumer API Secret Key* field.
. Click *Save*.
. Click the *Twitter* entry to collapse it. 
