First upload version 0.0.1
This commit is contained in:
31
node_modules/@octokit/oauth-methods/dist-src/reset-token.js
generated
vendored
Normal file
31
node_modules/@octokit/oauth-methods/dist-src/reset-token.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { request as defaultRequest } from "@octokit/request";
|
||||
async function resetToken(options) {
|
||||
const request = options.request || defaultRequest;
|
||||
const auth = btoa(`${options.clientId}:${options.clientSecret}`);
|
||||
const response = await request(
|
||||
"PATCH /applications/{client_id}/token",
|
||||
{
|
||||
headers: {
|
||||
authorization: `basic ${auth}`
|
||||
},
|
||||
client_id: options.clientId,
|
||||
access_token: options.token
|
||||
}
|
||||
);
|
||||
const authentication = {
|
||||
clientType: options.clientType,
|
||||
clientId: options.clientId,
|
||||
clientSecret: options.clientSecret,
|
||||
token: response.data.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 {
|
||||
resetToken
|
||||
};
|
||||
Reference in New Issue
Block a user