Skip to content

rodcordeiro/githubAuth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

To get a token you must follow a few steps

Creat an OAuth app

Here's the github doc

  • Follow the instructions on the documentation to create your OAuth App (follow this link to create).
  • On your app create a redirection to: https://github.com/login/oauth/authorize?client_id=YOUR_APP_CLIENT_ID&redirect_uri=YOUR_CALLBACK_URL&scope=THE_ACCESS_SCOPE&state=YOUR_STRING&allow_signup=true The YOUR_CALLBACK_URL is the url off your app site, on this case it will be http://localhost:3333/user
  • It will be redirected to the YOUR_CALLBACK_URL with the query params code and state. You will use the code to make a POST request to: https://github.com/login/oauth/access_token with some params on the body:
{
  "client_id": "YOUR_APP_CLIENT_ID",
  "client_secret": "YOUR_APP_CLIENT_SECRET",
  "code": "THE_CODE_RECEIVED",
  "state":"YOUR_STRING",
  "redirect_uri":"YOUR_CALLBACK_URL"
}
  • It will return a Json or xml with the following spec:
{
  "access_token":"SOME_TOKEN",
  "scope":"THE_ACCESS_SCOPE",
  "token_type":"bearer"
}

About

A github Auth app using Web Application Flow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published