调用github API使用github OauthAPP实现网站授权登录功能
2019-08-06 22:13
1256 查看
- Request a user’s GitHub identity(请求一个github用户的id)
GET https://github.com/login/oauth/authorize
When your GitHub App specifies a login parameter, it prompts users with a specific account they can use for signing in and authorizing your app.
Parameters(参数)
state:防止跨站点攻击 allow_signup:此参数可选填
- Users are redirected back to your site by GitHub(用户被github重定向到你的站点)
If the user accepts your request, GitHub redirects back to your site with a temporary code in a code parameter as well as the state you provided in the previous step in a state parameter. The temporary code will expire after 10 minutes. If the states don’t match, then a third party created the request, and you should abort the process.
Exchange this code for an access token:
POST https://github.com/login/oauth/access_token
Response
By default, the response takes the following form:
access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&token_type=bearer
3. Use the access token to access the API
The access token allows you to make requests to the API on a behalf of a user.
Authorization: token OAUTH-TOKEN
GET https://api.github.com/user
For example, in curl you can set the Authorization header like this:
curl -H “Authorization: token OAUTH-TOKEN” https://api.github.com/user
相关文章推荐
- Vue.js——使用$.ajax和vue-resource实现OAuth的注册、登录、注销和API调用【6】
- Vue.js使用$.ajax和vue-resource实现OAuth的注册、登录、注销和API调用
- Vue.js——使用$.ajax和vue-resource实现OAuth的注册、登录、注销和API调用
- vue.js学习07之使用$.ajax和vue-resource实现OAuth的注册、登录、注销和API调用
- 使用MQTT协议+Redis缓存实现APP登录顶号功能
- 用Python实现(第三方登录)使用GitHub账号登录(OAuth Python请求示例)
- PHP实现人人OAuth登录和API调用
- c#调用google api 实现google网站上翻译全功能(原创)
- 使用python登录新浪API,实现自动转发功能
- PHP实现人人OAuth登录和API调用
- PHP实现人人OAuth登录和API调用
- java web网站中使用shiro实现前后台登录功能
- PHP实现人人OAuth登录和API调用
- android调用第三方api实现用户数授权登录机制详解
- 不使用任何SDK实现Oauth授权并实现简单的发布微博功能:
- 使用token实现在有效期内APP自动登录功能
- 使用github的oauth来实现用户登录
- 使用flask+html实现网站的登录注册注销功能
- Chap5:使用JNI技术实现java程序调用第三方dll(c/c++)文件的功能
- JSP+JavaBean+Servlet技术实现某网站用户注册和登录功能