nydiarra / springboot-jwt

Example Springboot Application for Securing a REST API with JSON Web Token (JWT). For an example Integration with Angular (version 2+) go to https://github.com/ipassynk/angular-springboot-jwt
548 stars 330 forks source link

Angula4 Basic Auth not working #12

Open Suparuch opened 6 years ago

Suparuch commented 6 years ago

Hello,

I'm trying to connect a POST request to an API with Angular4, It's a very simple API with a Basic Authentication password. but is error preflight has invalid HTTP status code 401

I've got two headers "Content-Type" and "Authorization" headers.append("Content-Type", "application/x-www-form-urlencoded");

I've tried these two headers.

headers.append("Authorization", "Basic " + btoa(TOKEN_AUTH_USERNAME + ":" + TOKEN_AUTH_PASSWORD));

Hope someone can help