Auth0 Home Blog Docs

: Property 'crossOriginVerification' does not exist on type 'WebAuth'

auth0
auth0-in-angular-4

#1

Hello.
For this issue :

Failed to load https://watchdog.eu.auth0.com/oauth/token: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘https://my-website.com’ is therefore not allowed access.

I try to use the .crossOriginVerification on a new auth0.WebAuth. in my constructor with a SPA.

I use dependencies “auth0-js”: “^9.4.2”, “@angular/core”: “^4.3.6”,
and import * as auth0 from ‘auth0-js’;

But i said to me “: Property ‘crossOriginVerification’ does not exist on type ‘WebAuth’”

The WebAuth looks not to be the good one, in the exemple in (callback-cross-auth.html) they use the

here is my code:
this.appSettingsService.settings$.map(settings => {
new auth0.WebAuth({
clientID: settings.auth0.clientId,
domain: settings.auth0.domain,
redirectUri: ${location.protocol}//${location.host}/my-profile,
}).crossOriginVerification();
});

Wath i do wrong ?

Is my @types use not the good implementaion of crossOriginVerification(); for typescript ?


#2

This is probably a type definition issue. This method definitely exists:

However, the endpoint you’re trying to reach (oauth/token) doesn’t need to use that method and it’s not meant to be called from the browser. You should use webAuth.login instead.