Skip to content

ArnobKumarSaha/oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run

  1. Register a new OAuth application to your github account: https://github.com/settings/developers You will get the clientID & clientSecret there.
  2. Run the server go run *.go --client-id=<CLIENT_ID> --client-secret="CLIENT_SECRET"

Flow

  1. Visit http://localhost:8080/, click Login with github. This will make a request to the oAuth gateway(https://github.com/login/oauth/authorize) of github with clientID & redirect_uri as flags.
  2. Now give the authorization permission. If everything goes well, authorization server will redirect to the given redirect_uri.
  3. This redirected uri is handled by our server. We get the authorizationCode from request URL, & request to https://github.com/login/oauth/access_token by setting clientID, clientSecret & authz code to get the token.

Using token

  1. In the response, We will get the token. We then redirects to /hello endpoint (with access_token set), which is also handled by us.
  2. In /hello endpoint, we just use that access-token to get the user details from https://api.github.com/user.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published