Mit Instagram anmelden
9 min
instagram oauth tutorial einführung instagram oauth ermöglicht es benutzern, sich über oauth in apps mit ihrem instagram konto anzumelden voraussetzungen um dieses tutorial abzuschließen, benötigen sie eine app, die bei back4app erstellt wurde siehe den tutorial zum erstellen einer neuen app https //www back4app com/docs/get started/new parse app um zu lernen, wie man eine app bei back4app erstellt richten sie eine subdomain für ihre back4app app ein siehe aktivierung ihres webhostings und live abfrage https //www back4app com/docs/platform/activating web hosting um zu lernen, wie man eine subdomain in back4app erstellt ein instagram entwicklerkonto https //developers facebook com/docs/instagram 1 erstellen sie eine neue back4app app zunächst müssen sie sicherstellen, dass sie eine vorhandene app bei back4app erstellt haben wenn sie jedoch ein neuer benutzer sind, können sie dieses tutorial https //www back4app com/docs/get started/new parse app lesen, um zu lernen, wie man eine erstellt 2 erstellen sie einen neuen instagram app client melden sie sich bei ihrem instagram entwicklerkonto https //www instagram com/developer/ an und registrieren sie sich als entwickler geben sie ihre website, telefonnummer und eine beschreibung für ihre app ein akzeptieren sie die bedingungen, um fortzufahren gehe zu übersicht klicke auf \<font color="#2166ae">registriere deine anwendung\</font> klicke auf \<font color="#2166ae">registriere einen neuen client\</font> fülle das \<font color="#2166ae">anwendungsname\</font> , \<font color="#2166ae">beschreibung\</font> , \<font color="#2166ae">firmenname\</font> , \<font color="#2166ae">website url\</font> , \<font color="#2166ae">weiterleitungs uris\</font> , \<font color="#2166ae">url der datenschutzrichtlinie\</font> , und \<font color="#2166ae">kontakt e mail\</font> für die \<font color="#2166ae">gültigen weiterleitungs uris\</font> , wenn du nur versuchst, dein zugriffstoken abzurufen, kannst du es so lassen http //localhost andernfalls solltest du die produktions uri für die weiterleitung verwenden an diesem punkt solltest du einen client wie das bild unten haben klicken sie auf \<font color="#2166ae">verwalten\</font> und unter dem \<font color="#2166ae">sicherheit\</font> tab, deaktivieren sie die \<font color="#2166ae">implizite oauth deaktivieren\</font> 3 holen sie sich ihr token wenn sie ihre \<font color="#2166ae">umleitungs uris\</font> als \<font color="#2166ae">localhost\</font> , gibt es zwei möglichkeiten, wie sie ihr token abrufen können die erste möglichkeit besteht darin, ihren bevorzugten browser zu verwenden und die folgende url aufzurufen 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 dieser befehl gibt auch ihr zugriffstoken aus 4 starten sie die entwicklung jetzt, da die anmeldung mit instagram konfiguriert ist, können sie den entwicklungsprozess starten, indem sie das zugriffstoken verwenden, das sie zur authentifizierung abgerufen haben das format für authdata ist 1 { 2 "instagram" { 3 "id" "user's instagram id (string)", 4 "access token" "an authorized instagram access token for the user" 5 } 6 } hier ist die methode für das ios sdk 1 pfuser loginwithauthtype(inbackground "instagram", authdata \["access token"\ tokenstring, "id" user]) continuewith { task > any? in 2 3 } und hier für das 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 }