Platform
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 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 to learn how to create an subdomain in back4app an github account 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 application name application name , your homepage url homepage url , a quick description description and your authorization callback url authorization callback url ` then click register application register application you should then see your app secret app secret and client secret client secret 3 retrieve your code visit the following url, changing the values for client id client id for the one you created 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 your code your code , your client id your client id , and your client secret your client secret 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 }