diff --git a/src/framework/auth/strategies/auth-strategy.ts b/src/framework/auth/strategies/auth-strategy.ts index 4b4b7991fb..8aa148baa6 100644 --- a/src/framework/auth/strategies/auth-strategy.ts +++ b/src/framework/auth/strategies/auth-strategy.ts @@ -63,6 +63,6 @@ export abstract class NbAuthStrategy { protected getActionEndpoint(action: string): string { const actionEndpoint: string = this.getOption(`${action}.endpoint`); const baseEndpoint: string = this.getOption('baseEndpoint'); - return baseEndpoint + actionEndpoint; + return actionEndpoint ? baseEndpoint + actionEndpoint : ''; } } diff --git a/src/framework/auth/strategies/password/password-strategy.spec.ts b/src/framework/auth/strategies/password/password-strategy.spec.ts index 5eb6b7ba4f..1e6a50d0d8 100644 --- a/src/framework/auth/strategies/password/password-strategy.spec.ts +++ b/src/framework/auth/strategies/password/password-strategy.spec.ts @@ -589,6 +589,28 @@ describe('password-auth-strategy', () => { .flush(successResponse); }); + it('logout with no endpoint', (done: DoneFn) => { + + strategy.setOptions({ + name: ownerStrategyName, + baseEndpoint: '/api/auth/custom/', + logout: { + endpoint: '', + }, + }); + + strategy.logout() + .subscribe((result: NbAuthResult) => { + expect(result).toBeTruthy(); + expect(result.isFailure()).toBe(false); + expect(result.isSuccess()).toBe(true); + + done(); + }); + + httpMock.expectNone('/api/auth/custom/'); + }); + it('refreshToken', (done: DoneFn) => { strategy.refreshToken() .subscribe((result: NbAuthResult) => {