Website Login using github

Website Login using github

New OAuth in the github

github OAuth official documents

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

  • Application name Application name
  • Homepage URL request address your application
  • Application description describe your application
  • Authorization callback URL after successful authentication redirection address

After successful registration will generate a Client ID, Client Secret will be used later

Certification process

  1. Send a get request

https://github.com/login/oauth/authorize

Bring Client ID

 <a   href="https://github.com/login/oauth/authorize?client_id=xxxxxxxxxxx"
          >Sign in</a>

After confirming login, back to return to this address Authorization callback URL and carries a parameter code

  1. Get token
    sending request tape post
    client_id, code, client_secret

https://github.com/login/oauth/access_token

After a successful return access_token

  1. Obtaining user information
    transmitted get request tape accss_token

https://api.github.com/user?access_token=xxx

After the request is successful, get back to the current user's information

Published 83 original articles · won praise 21 · views 50000 +

Guess you like

Origin blog.csdn.net/JsongNeu/article/details/104147076