Twitter login
13 min
twitter login introduction this section explains how you can integrate twitter login into your javascript project after completing this step by step guide, you will be ready to upload your code to cloud code this project will use the newly released version 3 1 parse server on your project dashboard, go to server settings > manage parse server(settings) and select 3 1 1 for more information on migrating to parse server 3 1 x, see this guide https //www back4app com/docs/advanced guides/parse server 3 see this guide if you do not understand the syntax of the cloud code for this project prerequisites to begin with this tutorial, you will need an app created at back4app see the create new app tutorial https //www back4app com/docs/get started/new parse app to learn how to create an app at back4app set up a subdomain for your back4app app see activating your web hosting and live query https //www back4app com/docs/platform/activating web hosting to learn how to create an subdomain in back4app a twitter account https //twitter com/ and you must apply for developer access https //twitter com/i/flow/login?input flow data=%7b%22requested variant%22%3a%22eyjyzwrpcmvjdf9hznrlcl9sb2dpbii6imh0dhbzoi8vzgv2zwxvcgvylnr3axr0zxiuy29tl2vul3bvcnrhbc9wzxrpdglvbi9lc3nlbnrpywwvymfzawmtaw5mbyj9%22%7d 1 create a new back4app app first of all, it’s necessary to make sure that you have an existing app created at back4app however, if you are a new user, you can check this tutorial https //www back4app com/docs/get started/new parse app to learn how to create one 2 generate access tokens in order for you to get the twitter login working in your project, you must have the consumer key and consumer secret to generate your access tokens keys, you must have a twitter app basically, you have two options if you have existing twitter apps and you would like to edit them, please access the twitter app dashboard https //twitter com/i/flow/login?input flow data=%7b%22requested variant%22%3a%22eyjyzwrpcmvjdf9hznrlcl9sb2dpbii6imh0dhbzoi8vzgv2zwxvcgvylnr3axr0zxiuy29tl2vul2fwchmifq%3d%3d%22%7d if you want to create a new app, you can access the same dashboard, but you must have an approved developer account hint while you are requesting access for a developer account, you will certainly be asked to answer some questions, but don’t forget to agree with the terms of the contract 2 1 configure the app details in this topic, we’re going to configure the twitter app credentials note that it’s necessary to activate webhosting to this application and to read more about webhosting look at back4app webhosting tutorial https //www back4app com/docs/platform/parse web hosting after that go to twitter dashboard https //developer twitter com/en/apps and choose to \<font color="#2166ae">create an app\</font> or you can edit an existing app going to \<font color="#2166ae">details\</font> > \<font color="#2166ae">edit\</font> > \<font color="#2166ae">edit details\</font> fill up the app name application description tell us how this app will be used for the website url you can leave it as your back4app subdomain https //www back4app com/docs/platform/parse web hosting and the callback urls will be the subdomain https //www back4app com/docs/platform/parse web hosting + \<font color="#2166ae">/twitter callback\</font> it will looks something like this 3 twitter set up to start using the twitter login for javascript, you need to follow these steps to link back4app with your twitter app and log in to your back4app account; click on \<font color="#2166ae">server settings\</font> of your app then, click on \<font color="#2166ae">settings\</font> of the twitter login block it should look like this 4 get the template download the template at our github repository you can do that using the following command line curl lok https //github com/templates back4app/twitter login js/archive/master zip && unzip master zip 5 replace keys after downloading the project above, please open the \<font color="#2166ae"> /cloud/app js\</font> file and replace the following variables with the keys generated in step 2 const back4appwebhostdomain = ' \<font color="#eb144c">your back4app webhost domain\</font> '; const consumer key = ' \<font color="#eb144c">your consumer key\</font> '; const consumer secret = ' \<font color="#eb144c">your consumer secret\</font> '; 6 upload your code to back4app server to deploy your app with back4app, you need to upload your code to cloud code in order to do that, follow the steps below go to your app at back4app website https //www back4app com/ and click on \<font color="#2166ae">server settings\</font> find the “cloud code” block and click on \<font color="#2166ae">settings\</font> the ''cloud code'' block looks like this 3\ click on \<font color="#2166ae">choose files\</font> and select all the files imported by \<font color="#2166ae">index html\</font> move them to \<font color="#2166ae">public\</font> , then click \<font color="#2166ae">save\</font> , as shown here 4\ your files will look like this 7 it’s done after following the guide described above, you just need to open your browser with the web hosting address that you have created in case you need any help or a function/link doesn’t work, please contact our team via chat!