-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
Steps to reproduce the issue:
1- Clone repo
2-Run yarn install
3- run ng serve
4-go to the signup section
5-Fill the section with username, email and password
6- click the submit button
Actual
I am getting the below error:
Access to XMLHttpRequest at 'https://api.realworld.io/api/users' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Expected
I can register.
More notes:
I have added the "Access-Control-Allow-Origin" header in the call but I am still getting the same error.
register(credentials: {
username: string;
email: string;
password: string;
}): Observable<{ user: User }> {
return this.http
.post<{ user: User }>("/users", { user: credentials },{headers : {"Access-Control-Allow-Origin" : "*"}})
.pipe(tap(({ user }) => this.setAuth(user)));
}
Metadata
Metadata
Assignees
Labels
No labels