GithubHelp home page GithubHelp logo

No provider for NbAuthService! about nebular HOT 24 CLOSED

akveo avatar akveo commented on July 23, 2024
No provider for NbAuthService!

from nebular.

Comments (24)

airportly avatar airportly commented on July 23, 2024 3

any update on any documentation with examples of using an external auth provider such as auth0

from nebular.

wozaisuzhou avatar wozaisuzhou commented on July 23, 2024 3

based on the current version of nebular , you just need to import the library
import {NbThemeModule, NbLayoutModule, NbSidebarModule, NbButtonModule, NbMenuModule, NbSidebarService} from '@nebular/theme';

and then add the "NbSidebarService" to your provider :

providers: [NbSidebarService],

it should be working

from nebular.

nnixaa avatar nnixaa commented on July 23, 2024 2

@wilson-young have you resolved the issue? Please provide a complete description with code examples and steps. Thanks.

from nebular.

nnixaa avatar nnixaa commented on July 23, 2024 2

Hey Guys, we updated the Auth section of the documentation. Please read through the articles here https://akveo.github.io/nebular/#/docs/auth/introduction, hope this would be helpful!

from nebular.

nnixaa avatar nnixaa commented on July 23, 2024 2

Hi @manojvs, @thovo, there is no need to copy ALL sources to modify components templates. Just copy the components, change the references to the services and providers to be still imported from the Nebular and that's it. Otherwise, you end up not being able to update your code to a newer version of Nebular, as you will need to merge every file one by one.

from nebular.

thovo avatar thovo commented on July 23, 2024 1

And I currently also stopped at this error: Error: No provider for NbAuthService!

from nebular.

thovo avatar thovo commented on July 23, 2024 1

Okay, after moving around, it worked for me now, I can now customize the all auth part as I wish.
Ironically, when I followed the tutorial, it just leaded me to new errors.

  • So to be simple, you need to copy all the source files, include also services, providers and etc.
  • Add these lines in app.module.ts
import { NbAuthModule } from './@theme/components/auth/auth.module';
import { NbEmailPassAuthProvider } from './@theme/components/auth/providers/email-pass-auth.provider';
NbAuthModule.forRoot({
      providers: {
        email: {
          service: NbEmailPassAuthProvider,
          config: {},
        }
      }
    })
  • Compile again, stop the terminal first and restart it. Go to login component or any component you want, modify some text to see if it works.
  • If it works as expected, drink wine
  • Else, use hammer when deal with your boss

from nebular.

SalahudinMalik avatar SalahudinMalik commented on July 23, 2024 1

@wilson-young @nnixaa it work correctly but when I build using ng build --prod it gets components from node modules

from nebular.

wilson-young avatar wilson-young commented on July 23, 2024

in auth.component.ts i add a providers: [NbAuthService]
is it the correct way? but now the error change to core.es5.js:1020 ERROR Error: Uncaught (in promise): Error: No provider for NbTokenService!

from nebular.

wilson-young avatar wilson-young commented on July 23, 2024

@nnixaa,
Currently I have copied /framework/auth directory to my project src/app directory.
image
From the issue #12, u have said

In your particular case make sure that your app.routes correctly linked with your copied auth components, plus, as you copied them you have to tell Angular about that - so you need import them in some of your Angular modules (depending on your project structure). Hope this helps.

so i imported auth module into my app module
image

and i changed the import part in app-routing.module.ts
image

i also tried the add code in app.module as i see in documentation:
image
but i get the error nbEmailPassAuthProvider not found

i think my problem is i have done a wrong way to connect a custom auth directory into my ngx-admin project. can u help me with the best practice step for this issue? for customize auth module.

from nebular.

wilson-young avatar wilson-young commented on July 23, 2024

currently i get error when i try to access #/auth/login.

from nebular.

nnixaa avatar nnixaa commented on July 23, 2024

@wilson-young so as from the error - please import NbEmailPassAuthProvider in the app module and register it in providers section.

from nebular.

wilson-young avatar wilson-young commented on July 23, 2024

Thanks @nnixaa for respond, when i import
image

it will trigger error :
Can't export value NbEmailPassAuthProvider from NbAuthModule as it was neither declared nor imported!

note: can we have a more detail documentation about this case? about how to customize auth component, changing default register layout (because i think i need more user information in sign up page).

sorry for brothering you.
Thanks

from nebular.

nnixaa avatar nnixaa commented on July 23, 2024

@wilson-young we definitely will. So far it's hard to tell what's causing your issue. Generally, there is nothing special in the auth module - just a bunch of services and components. You can deploy a reproducible example to https://plnkr.co so that we can take a look.

from nebular.

wilson-young avatar wilson-young commented on July 23, 2024

app.zip

i cannot upload nebular auth module and ngx-admin to plunker,
so i attached the zip of my app directory.

from nebular.

naumanahmad17 avatar naumanahmad17 commented on July 23, 2024

@wilson-young have you sort out the issue ???

from nebular.

wilson-young avatar wilson-young commented on July 23, 2024

@naumanahmad17, no I haven't, I temporary using my own auth module.

from nebular.

naumanahmad17 avatar naumanahmad17 commented on July 23, 2024

@wilson-young thanks for the replay :). i am also going that way :)

from nebular.

wilson-young avatar wilson-young commented on July 23, 2024

@nnixaa, thanks for the update, i will try with new project later. thanks

from nebular.

thovo avatar thovo commented on July 23, 2024

@wilson-young can you do it now?
I followed the tutorial and just found out that I couldn't include just only source, when compiled, the compiler said I was missing a service inside auth.component so I copied the whole source include service. It worked but it didn't recognize router-outlet so I did added RouterModule into theme.module.ts . @nnixaa I think you may need to update the tutorial or I did something wrong.

from nebular.

 avatar commented on July 23, 2024

An extension of the suggestion from @thovo - copying all source files from https://github.com/akveo/nebular/tree/master/src/framework/auth to 'theme/components/auth'

core.module.ts
import { NbAuthModule, NbDummyAuthProvider } from '../@theme/components/auth'; // '@nebular/auth';

app-routing.module.ts

import {
  NbAuthComponent,
  NbLoginComponent,
  NbLogoutComponent,
  NbRegisterComponent,
  NbRequestPasswordComponent,
  NbResetPasswordComponent,
} from './@theme/components/auth'; //'@nebular/auth';

theme.module.ts (instead of app.module.ts)

import { NbAuthModule } from './components/auth/auth.module';
import { NbEmailPassAuthProvider } from './components/auth/providers/email-pass-auth.provider';
NbAuthModule.forRoot({
      providers: {
        email: {
          service: NbEmailPassAuthProvider,
          config: {},
        }
      }
    }).providers,

from nebular.

nnixaa avatar nnixaa commented on July 23, 2024

Closing this one as the conversation is out of the initial topic.

from nebular.

AppHero2 avatar AppHero2 commented on July 23, 2024

I was trying to integrate firebase registration with nebular. How can I do this? any example?

from nebular.

 avatar commented on July 23, 2024

An extension of the suggestion from @thovo - copying all source files from https://github.com/akveo/nebular/tree/master/src/framework/auth to 'theme/components/auth'

core.module.ts
import { NbAuthModule, NbDummyAuthProvider } from '../@theme/components/auth'; // '@nebular/auth';

app-routing.module.ts

import {
  NbAuthComponent,
  NbLoginComponent,
  NbLogoutComponent,
  NbRegisterComponent,
  NbRequestPasswordComponent,
  NbResetPasswordComponent,
} from './@theme/components/auth'; //'@nebular/auth';

theme.module.ts (instead of app.module.ts)

import { NbAuthModule } from './components/auth/auth.module';
import { NbEmailPassAuthProvider } from './components/auth/providers/email-pass-auth.provider';
NbAuthModule.forRoot({
      providers: {
        email: {
          service: NbEmailPassAuthProvider,
          config: {},
        }
      }
    }).providers,

that is the right answer but you should do it according to the change list in in this address

from nebular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.