auth-node: provide passport OAuth helper types
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -15,7 +15,11 @@
|
||||
*/
|
||||
|
||||
import { Strategy } from 'passport';
|
||||
import { PassportHelpers, PassportProfile } from '../passport';
|
||||
import {
|
||||
PassportDoneCallback,
|
||||
PassportHelpers,
|
||||
PassportProfile,
|
||||
} from '../passport';
|
||||
import {
|
||||
OAuthAuthenticatorAuthenticateInput,
|
||||
OAuthAuthenticatorRefreshInput,
|
||||
@@ -24,7 +28,7 @@ import {
|
||||
OAuthProfileTransform,
|
||||
} from './types';
|
||||
|
||||
/** @internal */
|
||||
/** @public */
|
||||
export type PassportOAuthResult = {
|
||||
fullProfile: PassportProfile;
|
||||
params: {
|
||||
@@ -36,6 +40,17 @@ export type PassportOAuthResult = {
|
||||
accessToken: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type PassportOAuthPrivateInfo = {
|
||||
refreshToken?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type PassportOAuthDoneCallback = PassportDoneCallback<
|
||||
PassportOAuthResult,
|
||||
PassportOAuthPrivateInfo
|
||||
>;
|
||||
|
||||
/** @public */
|
||||
export class PassportOAuthAuthenticatorHelper {
|
||||
static defaultProfileTransform: OAuthProfileTransform<PassportProfile> =
|
||||
@@ -73,7 +88,7 @@ export class PassportOAuthAuthenticatorHelper {
|
||||
const { result, privateInfo } =
|
||||
await PassportHelpers.executeFrameHandlerStrategy<
|
||||
PassportOAuthResult,
|
||||
{ refreshToken?: string }
|
||||
PassportOAuthPrivateInfo
|
||||
>(input.req, this.#strategy);
|
||||
|
||||
return {
|
||||
|
||||
@@ -18,7 +18,12 @@ export {
|
||||
createOAuthHandlers,
|
||||
type OAuthHandlersOptions,
|
||||
} from './createOAuthHandlers';
|
||||
export { PassportOAuthAuthenticatorHelper } from './PassportOAuthAuthenticatorHelper';
|
||||
export {
|
||||
PassportOAuthAuthenticatorHelper,
|
||||
type PassportOAuthDoneCallback,
|
||||
type PassportOAuthPrivateInfo,
|
||||
type PassportOAuthResult,
|
||||
} from './PassportOAuthAuthenticatorHelper';
|
||||
export {
|
||||
createOAuthAuthenticator,
|
||||
type OAuthAuthenticator,
|
||||
|
||||
Reference in New Issue
Block a user