Skip to content

xibang/github-oauth-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@xibang/github-oauth-sdk

npm npm npm

说明

由于该项目过于简单,暂不发布。请直接查阅源码

示例

获取登录地址

const SDK = require('@xibang/github-oauth-sdk');

const sdk = SDK({
  client_id: 'xxx',
  client_secret: 'xxx',
  redirect_uri: 'http://xxxx/callback/github'
});

console.log(sdk.authorize_url({
  scope: 'user',
  state: 'testxxx'
}));

获取 Access Token

const SDK = require('@xibang/github-oauth-sdk');

const sdk = SDK({
  client_id: 'xxx',
  client_secret: 'xxx',
  redirect_uri: 'http://xxxx/callback/github'
});

sdk.access_token({ code: 'xxxxxx' }).then(console.log);
// { access_token: 'xxxxxx',
//   token_type: 'bearer',
//   scope: 'user' }

License

Apache 2.0

通过支付宝捐赠:

qr

Releases

No releases published

Packages

No packages published