First upload version 0.0.1
This commit is contained in:
40
node_modules/@octokit/auth-oauth-app/dist-src/auth.js
generated
vendored
Normal file
40
node_modules/@octokit/auth-oauth-app/dist-src/auth.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { createOAuthUserAuth } from "@octokit/auth-oauth-user";
|
||||
async function auth(state, authOptions) {
|
||||
if (authOptions.type === "oauth-app") {
|
||||
return {
|
||||
type: "oauth-app",
|
||||
clientId: state.clientId,
|
||||
clientSecret: state.clientSecret,
|
||||
clientType: state.clientType,
|
||||
headers: {
|
||||
authorization: `basic ${btoa(
|
||||
`${state.clientId}:${state.clientSecret}`
|
||||
)}`
|
||||
}
|
||||
};
|
||||
}
|
||||
if ("factory" in authOptions) {
|
||||
const { type, ...options } = {
|
||||
...authOptions,
|
||||
...state
|
||||
};
|
||||
return authOptions.factory(options);
|
||||
}
|
||||
const common = {
|
||||
clientId: state.clientId,
|
||||
clientSecret: state.clientSecret,
|
||||
request: state.request,
|
||||
...authOptions
|
||||
};
|
||||
const userAuth = state.clientType === "oauth-app" ? await createOAuthUserAuth({
|
||||
...common,
|
||||
clientType: state.clientType
|
||||
}) : await createOAuthUserAuth({
|
||||
...common,
|
||||
clientType: state.clientType
|
||||
});
|
||||
return userAuth();
|
||||
}
|
||||
export {
|
||||
auth
|
||||
};
|
||||
Reference in New Issue
Block a user