Support for organizations is not provided in Typescript definitions
skillseeker-io opened this issue · 2 comments
Describe the problem
The documentation at https://auth0.github.io/auth0.js/index.html indicates that support for organizations is now built in to the definitions of the auth0.WebAuth
object and also its authorize
method. However, although the code builds using webpack
, it doesn't work (and the linter in VSCode complains the 'organization' property is not defined in AuthOptions
). This means that Typescript cannot be used for this option.
What was the expected behavior?
I would expect the local project application to run, redirect to the Auth0 authorize
endpoint, and display the standard Universal Login prompt for the organization name.
Reproduction
- Prerequisite: Set up a test Application in Auth0, enable it to use Organizations for all users, and set up a test Organization with a social connection (Google-OAuth2). Pre-populate with a google-authenticated member user
- Step 1 Using a
Node.js
React SPA written in Typescript, update the project'spackage.json
to set the version field for auth0-js in the dependencies array to 9.16.4 - Step 2 Update source code to set the
organization
field to in calls tonew WebAuth({...})
orwebAuth.authorize({...})
; for example:
...
this.auth0 = new WebAuth({
domain: config.domain,
clientID: config.clientId,
redirectUri: origin + "/auth0-callback",
responseType: "token id_token",
scope: "openid profile email",
organization: "org_ID"
});
...
- Step 3 recompile/transpile using webpack (actually compiles)
- Attempt to run project to connect to the Auth0 test application. Application fails with following error:
ERROR in /.../src/auth.ts(39,7):
TS2345: Argument of type '{ domain: string; clientID: string; redirectUri: string; responseType: string; scope: string; organization: string; }' is not assignable to parameter of type 'AuthOptions'.
Object literal may only specify known properties, and 'organization' does not exist in type 'AuthOptions'.
Environment
- auth0-js version 9.16.4
- node.js version 10.18.1
- Tested in Firefox 93.0 on Mac
👋🏻 We don't publish types as part of this library yet, are you using the types from DefinitelyTyped?
If so, unfortunately we don't currently own those types. In this case you should reach out to the maintainers or raise a PR against that repo.
Thank you, I've raised an issue there and I'm closing this issue now.