auth0-ionic2-samples
auth0-ionic2-samples copied to clipboard
Using @types
I'm really excited to use Auth0 in my ionic application, but it seems that this example is quite up to date. I don't think adding scripts to index.html is a valid approach.
What I'm trying to do is to get it working with DI. I have:
- installed
auth0
,auth0-lock
,@types/auth0
and@types/auth0-lock
modules -
import Auth0 from 'auth0';
andimport Auth0Lock from 'auth0-lock';
in my user-session.ts provider and provide it in the app module viaproviders
. - I'm trying to inject it in the constructor, like
constructor(auth0: Auth0, lock: Auth0Lock) {}
Now I'm stuck. I'm unable to figure out how to initialise Auth0 and pass Auth0ClientOptions (http://definitelytyped.org/docs/auth0--auth0/interfaces/auth0clientoptions.html). This method gives me Cannot find name 'Auth0'
. When I try to instantiate it in the injectable class
auth0 = new Auth0(this.auth0ClientOptions);
but then it's Cannot use 'new' with an expression whose type lacks a call or construct signature.
Could you update the example to use Dependency Injections and/or properly use typed libraries?