Mahesh Kumar
Mahesh Kumar

Reputation: 63

Secure credentials in Angular 4 typescript

From my angular 4 typescript code, i am using HttpClient to call RESTful services. To call REST services, i am passing plain basic auth credentials in HTTP header like below:

let headers: Headers = new Headers(); headers.append('Authorization', 'Basic username:password'); this.httpClient.post(url, body, { headers: headers })

I need to secure username and password in the typescript code since typescript will convert to java script (after build) which i guess hacker can dig into the bundled js files and take this plain credentials and use it for attacks.

Could someone help me giving ideas to secure my plain credentials in typescript code?

Upvotes: 1

Views: 833

Answers (1)

baj9032
baj9032

Reputation: 2592

Actually, Angular is used to build single page application using java script.That's why there is no way to secure your token or every thing. You can secure your token or everything from back-end (using api's) by using package like JWT.

Upvotes: 2

Related Questions