-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
follow up to #18 and related to #11
What we want is the following
import { Octokit } from "@octokit-next/core";
type CallbackStrategyOptions = {
callback: () => string | Promise<string>;
};
function createCallbackAuth(options: CallbackStrategyOptions) {
return async function auth() {
return options.callback();
};
}
const OctokitWithCallbackAuth = Octokit.withDefaults({
authStrategy: createCallbackAuth,
});
// compiler should complain: `{ auth }` should be required because `authStrategy` is set to `createCallbackAuth` by default
new OctokitWithCallbackAuth();
Here is how auth strategies work in Octokit via the authStrategy
and auth
options:
https://github.com/octokit/authentication-strategies.js#authenticationstrategystrategyoptions