Giter Club home page Giter Club logo

oauth-go's Introduction

Defining your application to GitHub

1. Sign in to GitHub and go to Settings, Oauth Applications.

2. For "Authorization Callback URL", specify "http://12.13.14.15:8888/callmebacktomorrow" (this must match oauthproxy.go line 645 as described below).

Running your application (a trivial Go web server)

3. From ssh session one, run the trivial Go server. It's listening on :8888.

clientid=<your GitHub app client id>
clientsecret=<your GitHub app client secret>
cd ~/oauth-go
./bin/jquery $clientid $clientsecret

Running oauth2_proxy

4. Get oauth2_proxy

cd ~/oauth-go
go get github.com/bitly/oauth2_proxy

5. Make sure the oauth2-proxy will forward the correct callback_uri.

  1. Force oauthproxy.go line 645 to "http://12.13.14.15:8888/callmebacktomorrow" (TODO: This manual override is necessary, but why?)
  2. go install github.com/bitly/oauth2_proxy
  3. Update the GitHub settings to that same string. This allows the browser access to a further GitHub authorization you-choose-โ€˜em page.

6. From ssh session two, run oauth2-proxy. It's listening on :4180.

cd ~/oauth-go
clientid=<your GitHub app client id>
clientsecret=<your GitHub app client secret>
./cli-oauth2_proxy $clientid $clientsecret

Running the test to see Github authentication in action

7. From a browser, start the authentication sequence.

http://12.13.14.15:8887

What's happening

nginx is listening on :8887, authenticates (TODO: authentication is redundant, actually superfluous, so remove this), forwards to oauth2_proxy, which forwards to GitHub, which returns a code to your app via the callback URL, your app sends the code back to GitHub and receives an access_token (TODO: where?), your app uses the access_token to make a GitHub API call.

If your app was only using GitHub for authentication and cared nothing about GitHub itself, then your app would then manage your application's authorizations

TODO: Incorporate something equivalent to the AWS federation login S3 example.

Bibliography

oauth-go's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.