I have an API, using the ASP core as my back end. At the back end, a JWT is generated. I can access the data from the postman using the generated token. But using Angular, I do not understand how to access that token. My question is, how to give the token to Angular and how to access Authorized Endpoints?
Here is my HTML form
<form>
<label for="">Username</label>
<input type="text" name="username" id="username" class="form-control mb-2" [(ngModel)]="usrname">
<label for="">Password</label>
<input type="password" name="password" id="password" class="form-control" [(ngModel)]="password">
<button class="btn btn-primary mt-3" (click)="submit()">Submit</button>
</form>
Here is the code in my TS file
submit(){
var submitdata = {
username:this.usrname,
Password:this.password
}
this.service.loginProcess(submitdata).subscribe(results =>{
console.log(results);
});
}
This is the service file
loginProcess(data:any){
return this.http.post(this.ProServiceAPIUrl + '/Logins',data);
}