akveo / nebular

:boom: Customizable Angular UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/nebular
MIT License
8.04k stars 1.51k forks source link

Can't make the authenticate method to make a request to baseEndpoint #550

Closed VictorSchleumer closed 6 years ago

VictorSchleumer commented 6 years ago

Issue type

I'm submitting a ...

Issue description

Current behavior:

After following the docs, i could not make request to baseEndpoint specified in the app.module.

Expected behavior:

Being possible to make this request.

Related code:

Github Repository (https://github.com/VictorSchleumer/admin-dashboard/tree/master/frontend)

NbAuthModule.forRoot({
            strategies: [
                NbPasswordAuthStrategy.setup({
                    name: 'email',
                    token: {
                        class: NbAuthJWTToken,
                        key: 'token',
                    },
                    baseEndpoint: 'http://localhost:8000',
                    login: {
                        endpoint: environment.api.loginEndpoint,
                        method: 'post',
                    },
                    register: {
                        endpoint: environment.api.registerEndpoint,
                        method: 'post',
                    },
                }),
            ],
            forms: {
                login: {
                    redirectDelay: 0,
                    showMessages: {
                        success: true,
                    },
                },
                register: {
                    redirectDelay: 0,
                    showMessages: {
                        success: true,
                    },
                },
            },
        }),

Other information:

The environment is a fresh install of nebular latest version, with the auth folder copied over from frameworks/auth/component folder. npm, node, OS, Browser


Node, node: `v8.11.1` and npm: `5.5.1`
OS: Windows 10.
Browser: Chrome

Angular, Nebular

<!--
Check your `package-lock.json` or locate a `package.json` in the `node_modules` folder.
-->
nnixaa commented 6 years ago

Hi @VictorSchleumer, could you please elaborate? Are you getting an error? Also, your stackblitz example isn't' working, could you fix it so that we can check?

VictorSchleumer commented 6 years ago

Hi @nnixaa , i uploaded to Github my code (https://github.com/VictorSchleumer/admin-dashboard/tree/master/frontend), im not getting a error, it seems like it still using the dummy login, because it don't send a request.

nnixaa commented 6 years ago

@VictorSchleumer as far as I can tell you have two strategies configured under the same name (email), the first one is in your app.module and the second one is here https://github.com/VictorSchleumer/admin-dashboard/blob/master/frontend/src/app/%40core/core.module.ts#L44. Leave just one of them and it should be fine.

VictorSchleumer commented 6 years ago

Thank you, i removed one and it worked. Thanks for your time.