Upgrade octokit to v4.1.2
This commit is contained in:
parent
dbbcbe019d
commit
c1745a9831
1214 changed files with 160765 additions and 0 deletions
29
node_modules/@octokit/oauth-methods/dist-src/check-token.js
generated
vendored
Normal file
29
node_modules/@octokit/oauth-methods/dist-src/check-token.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { request as defaultRequest } from "@octokit/request";
|
||||
async function checkToken(options) {
|
||||
const request = options.request || defaultRequest;
|
||||
const response = await request("POST /applications/{client_id}/token", {
|
||||
headers: {
|
||||
authorization: `basic ${btoa(
|
||||
`${options.clientId}:${options.clientSecret}`
|
||||
)}`
|
||||
},
|
||||
client_id: options.clientId,
|
||||
access_token: options.token
|
||||
});
|
||||
const authentication = {
|
||||
clientType: options.clientType,
|
||||
clientId: options.clientId,
|
||||
clientSecret: options.clientSecret,
|
||||
token: options.token,
|
||||
scopes: response.data.scopes
|
||||
};
|
||||
if (response.data.expires_at)
|
||||
authentication.expiresAt = response.data.expires_at;
|
||||
if (options.clientType === "github-app") {
|
||||
delete authentication.scopes;
|
||||
}
|
||||
return { ...response, authentication };
|
||||
}
|
||||
export {
|
||||
checkToken
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue