@diaspora/webapi-provider-oauth2
Version:
Event provider for the WebAPI adapter, to use OAuth2 authentication
28 lines (27 loc) • 871 B
TypeScript
export interface IConfig {
endPoint: string;
grantType: string;
clientId: string;
clientSecret: string;
}
export declare enum QueryType {
Find,
Update,
Delete,
Insert,
}
export declare enum QueryNum {
One,
Many,
}
/**
* Generate an event provider object to authenticate through OAuth2 before doing queries.
*
* @param config Configuration object related to the OAuth2 authentication.
* @returns An event provider object. Each keys is an event handler function.
*/
export declare const OAuth2QueryTransformer: (config: IConfig) => {
authenticate(this: any, url: string, params: object): Promise<void>;
initialize(this: any): Promise<void>;
beforeQuery(queryType: QueryType, queryNum: QueryNum, modelName: string, select: object, update: object, options: object, apiDesc: object): any;
};