I just started using Auth0 a few days ago and have run into issues after getting auth to work.
I am using the Universal Login with success. Immediately after the user is authenticated I hit my endpoint (https://api.{DOMAIN}.ca/api/users/me
) but receive the following error: Access to XMLHttpRequest at 'https://api.{DOMAIN}.ca/api/users/me' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
In the screenshot below you can see that http://localhost:4200
is an allowed CORS origin.
Here is the code snippet where the endpoint is hit:
environment.api.users = ‘https://api.{DOMAIN}.ca/api/users’
getMe(): Observable<UserModel> {
return this.http
.get<UserModel>(`${`${environment.api.users}`}/me`)
.pipe(
map(result => result),
catchError(error => throwError(error))
);
}
I have tried using an endpoint of https://api.{DOMAIN}.ca/api/v2/users
as I’ve seen in some cases.