Sign Up With GitHub
8 min
sign in with github tutorial introduction sign in with github enables users to sign in to apps using their github accounts 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 an subdomain in back4app an github account https //github com/ 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 github app create a new github application by going to applications/new https //github com/settings/applications/new fill up the \<font color="#2166ae">application name\</font> , your \<font color="#2166ae">homepage url\</font> , a quick \<font color="#2166ae">description\</font> and your \<font color="#2166ae">authorization callback url\</font> ` then click \<font color="#2166ae">register application\</font> you should then see your \<font color="#2166ae"> app secret\</font> and \<font color="#2166ae">client secret\</font> 3 retrieve your code visit the following url, changing the values for \<font color="#2166ae">client id\</font> for the one you created https //github com/login/oauth/authorize scope=user\ email\&client id=client id log in with your github account and the redirected website will have your code in the url copy the code part of the url only and run the following curl command replacing the values \<font color="#2166ae">your code\</font> , \<font color="#2166ae">your client id\</font> , and \<font color="#2166ae">your client secret\</font> for the values of your application 1 curl x post \\ 2 f \\'client id=your client id' 3 f 'client secret=your client secret' 4 f 'code=your code' 5 f 'accept=json' 6 https //github com/login/oauth/access token run it and you should retrieve your access token remember the code can be used only once if you get an error or don’t use your token, you must re generate your code to be able to run it again 4 start the development now that the sign in with github is configured, you can start the development process the format for authdata is 1 { 2 "github" { 3 "id" "user's github id (string)", 4 "access token" "an authorized github access token for the user" 5 } 6 } here is the method for the ios sdk 1 pfuser loginwithauthtype(inbackground "github", authdata \["access token"\ tokenstring, "id" user]) continuewith { task > any? in 2 3 } and here for the android sdk 1 map\<string, string, bool> authdata = new hashmap\<string, string, bool>(); 2 authdata put("access token", tokenstring); 3 authdata put("id", user); 4 parseuser loginwithinbackground("github", authdata){ 5 6 }