client-oauth2-request
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

client-oauth2-request

client-oauth2 request
import getToken from 'gitee-api-token';
import ClientRequest from 'client-oauth2-request';
 
(async () =>
{
 
    let token = await getToken({
        access_token: 'access_token',
 
        //username: '',
        //password: '',
 
        clientId: '',
        clientSecret: '',
 
        scopes: 'pull_requests',
    })
        .catch(function (err)
        {
            console.log(err);
        })
    ;
 
    if (!token)
    {
        console.error(`can't get token`);
 
        return;
    }
 
    let rq = new ClientRequest(token, {
        apiRoot: 'https://gitee.com/api/'
    });
 
    let rp = rq.sign('/v5/repos/oschina/git-osc/pulls');
 
    let r = await rq.get(rp.url, rp)
        .catch(function (err)
        {
            console.error(err);
        })
    ;
 
    console.log(r);
 
})();

Package Sidebar

Install

npm i client-oauth2-request

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

16.6 kB

Total Files

5

Last publish

Collaborators

  • bluelovers