가 여기 내 각 방법요청 (401)
getGiftList(url: string){
let q = this.baseUrl + url;
let headers = new HttpHeaders();
let authToken = 'Bearer ' + this.authService.currentUser.token;
console.log(q); //Log the url ...
console.log(authToken); Log the token ...
headers.set('Authorization', authToken)
return this.http.get(q, {
observe: 'response'
,headers: headers
})
}
의 반환 내가로부터 요청을 할 때의 Asp.net 코어 방법
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
public class GiftController : Controller
{
[HttpGet("api/giftsByGiver/{email}")]
public IActionResult getGiftBasicRecordsByGiver(string email, int cpg = 1)
{
//
}
}
입니다 내 각 코드, 401
오류가 발생합니다. 그러나 필자가 Postman에 기록한 것과 동일한 값을 복사/실행하면 올바른 결과를 얻게됩니다.
내가 누락 된 항목이 있습니까?
우편 발송인에 승인 헤더가 있는지 여부를 확인 했습니까? 그들은주의하기 어려울 수 있습니다. 여러분은 머리말 탭 –
@PaulDegnan을 열어야합니다. 개발을 위해서 그리고 나는 여전히 배우기 때문에, 나는'origin, method 및 header를 허용하는 정책을 설정했습니다 '. – Richard77