UNPKG

@xrengine/server-core

Version:

Shared components for XREngine server

29 lines (23 loc) 906 B
import { OAuthStrategy } from '@feathersjs/authentication-oauth' import { Params } from '@feathersjs/feathers' import { Application } from '../../../declarations' // import { OAuthProfile } from '@feathersjs/authentication-oauth/src/strategy' export interface CustomOAuthParams extends Params { redirect?: string access_token?: string } export class CustomOAuthStrategy extends OAuthStrategy { // @ts-ignore app: Application async getEntityQuery(profile: any, _params: Params): Promise<any> { return { token: profile.sub ? `${this.name}:::${profile.sub as string}` : `${this.name}:::${profile.id as string}` } } async getEntityData(profile: any, _existingEntity: any, _params: Params): Promise<any> { return { token: profile.sub ? `${this.name}:::${profile.sub as string}` : `${this.name}:::${profile.id as string}` } } } export default CustomOAuthStrategy