Conversation
This is the sample project built by following the "[Basics of Authentication][basics of auth]" guide on developer.github.com - ported to Go. As the Go standard library does not come with built-in web session handling, only the [simple example](https://github.com/github/platform-samples/blob/master/api/ruby/basics-of-authentication/server.rb) was ported. The example also shows how to use the [GitHub golang SDK](https://github.com/google/go-github).
Contributor
Author
|
@larsxschneider: friendly bump 😊 |
|
I'm afraid I don't have the bandwidth to review this at the moment 🙁 |
primetheus
approved these changes
Jun 28, 2019
|
Got some hacking into me on this I.p address 2a01:4c8:42d:37d9:1:2:a748:be2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
basics-of-authentication
This is the sample project built by following the "Basics of Authentication"
guide on developer.github.com - ported to Go.
As the Go standard library does not come with built-in web session handling, only the simple example was ported. The example also shows how to use the GitHub golang SDK.
Install and Run project
First, of all, you would need to follow the steps in the GitHub OAuth Developer Guide to register an OAuth application with callback URL
http://localhost:4567/callback.Copy the client id and the secret of your newly created app and set them as environmental variables:
export GH_BASIC_SECRET_ID=<application secret>export GH_BASIC_CLIENT_ID=<client id>Make sure you have Go installed; then retrieve the modules needed for the go-github client library by running
go get github.com/google/go-github/githubandgo get golang.org/x/oauth2on the command line.Finally, type
go run server.goon the command line.This command will run the server at
localhost:4567. Visithttp://localhost:4567with your browser to get your GitHub email addresses revealed (after authorizing the GitHub OAuth App).If you should get any errors while redirecting to GitHub, double check your environmental variables and the callback URL you set while registering your OAuth app.