auth0-js/index.d.ts file in this repo and had problems.auth0-js/index.d.ts.The definition of auth0-js is not compatible with angular-cli and webpack!
The export module name should be "auth0-js" and not just "auth0".
The login callback signature is not correct for the latest version 7.2.0
Why did you close the issue? Did you find a fix?
I realized that I close the issue by mistake.
In fact, the issue I have is that when I try to import the auth0 library, the angular-cli (webpack) indicates that it cannot resolve 'auth0'.
The import statement is import Auth0 from 'auth0' but the node module is called auth0-js.
For the login method declaration, you use the type "any" for the options instead of the type Auth0LoginOptions.
It also seems that the Auth0LoginOptions is not complete (more options exist) and the callback is not correct neither.
There are two projects node-auth0 and auth0.js. The former is an npm package, and we want @types/auth0 to correspond to the auth0 package, so we name its typings auth0. I would presume angular is trying to import the npm package, so you probably just have the wrong typings installed?
I have both auth0-js and @types/auth0-js packages installed. But the package @types/auth0-js declare a module called "auth0" (not "auth0-js") then when angular-cli tries to compile, it cannot find the module "auth0-js" since it tries to load "auth0".
Here is my package.json
{
"name": "demo-app",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"angular2-jwt": "^0.1.23",
"auth0-js": "^7.2.1",
"bootstrap": "^4.0.0-alpha.4",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/auth0-js": "0.0.3",
"@types/jasmine": "^2.2.30",
"angular-cli": "1.0.0-beta.14",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.5",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
}
}
Also, the @types/auth0-js package is not up-to-date with the latest auth0-js package in term of API.
Examples:
The Auth0DecodeHash interface is not correct.
You define the following interface:
interface Auth0DecodedHash {
access_token: string;
id_token: string;
profile: Auth0UserProfile;
state: any;
}
but what I receive when calling the "parseHash" method is
{
accessToken: 'xxxx',
idToken: 'xxxx',
idTokenPayload: Object,
refreshToken: 'xxxx',
state: undefined
}
And there are also some missing methods on the Auth0 object and some are not up-to-date.
Has there been any update on this? How did people get this to work? I'm still having this issue with 8.10.2
Most helpful comment
Also, the
@types/auth0-jspackage is not up-to-date with the latestauth0-jspackage in term of API.Examples:
The Auth0DecodeHash interface is not correct.
You define the following interface:
but what I receive when calling the "parseHash" method is
And there are also some missing methods on the Auth0 object and some are not up-to-date.