Skip to content
No description or website provided.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.editorconfig
.eslintrc.yml
.gitignore
.npmignore
LICENSE
README.md
package.json
yarn.lock

README.md

@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

You can’t perform that action at this time.