Sign Up With Instagram
9 min
instagram oauth tutorial introduction instagram oauth enables users to sign in to apps using their instagram account through oauth prerequisites to complete 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 a subdomain in back4app an instagram developer account https //developers facebook com/docs/instagram 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 create a new instagram app client log into your instagram developer account https //www instagram com/developer/ and sign up as a developer enter your website, telephone, and a description for your app accept the terms to proceed go to overview click on \<font color="#2166ae">register your application\</font> click on \<font color="#2166ae">register a new client\</font> fill up the \<font color="#2166ae">application name\</font> , \<font color="#2166ae">description\</font> , \<font color="#2166ae">company name\</font> , \<font color="#2166ae">website url\</font> , \<font color="#2166ae">redirect uris\</font> , \<font color="#2166ae">privacy policy url\</font> , and \<font color="#2166ae">contact email\</font> for the \<font color="#2166ae">valid redirect uris\</font> , if you are only trying to retrieve your access token, you can leave it as http //localhost otherwise, you should use the production uri for redirection at this point, you should have a client like the image below click on \<font color="#2166ae">manage\</font> and under the \<font color="#2166ae">security\</font> tab, uncheck the \<font color="#2166ae">disable implicit oauth\</font> 3 retrieve your token if you left your \<font color="#2166ae">redirect uris\</font> as \<font color="#2166ae">localhost\</font> , there are two ways you can retrieve your token the first one is using your browser of choice, and going to the following url https //api instagram com/oauth/authorize/?client id=client id\&redirect uri=redirect uri\&response type=code https //api instagram com/oauth/authorize/?client id=client id\&redirect uri=redirect uri\&response type=code just change the \<font color="#2166ae">client id\</font> and \<font color="#2166ae">redirect uri\</font> using the values you got from your newly created client this will redirect you to an invalid page, but show you the access token in the url the other way to retrieve such a token is to run the following curl command, replacing the \<font color="#2166ae">client id\</font> , \<font color="#2166ae">client secret\</font> , and \<font color="#2166ae">redirect uri\</font> for your values 1 curl \\ f 'client id=client id' \\ 2 f 'client secret=client secret' \\ 3 f 'grant type=authorization code' \\ 4 f 'redirect uri=redirect uri' \\ 5 f 'code=code' \\ 6 https //api instagram com/oauth/access token that command will also output your access token 4 start the development now that the sign in with instagram is configured, you can start the development process passing the access token you retrieved for authentication the format for authdata is 1 { 2 "instagram" { 3 "id" "user's instagram id (string)", 4 "access token" "an authorized instagram access token for the user" 5 } 6 } here is the method for the ios sdk 1 pfuser loginwithauthtype(inbackground "instagram", authdata \["access token"\ tokenstring, "id" user]) continuewith { task > any? in 2 3 } and here for the android sdk 1 map\<string, string> authdata = new hashmap\<string, string>(); 2 authdata put("access token", tokenstring); 3 authdata put("id", user); 4 parseuser loginwithinbackground("instagram", authdata){ 5 6 }