Когда я запрашиваю ключ токена от angular8, происходит неавторизованная ошибка.Какой заголовок http необходим.Тело запроса включает в себя (имя пользователя, пароль и тип_транспорта) -
login() {
const header = new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded',
'No-Auth': 'True'
});
this.http.post(this.url, this.body, {headers: header}).subscribe( res => {
console.log(res);
});
}
Данные ответа -
{
"status": "SUCCESS",
"data": {
"timestamp": "2019-09-21T04:49:25.021+0000",
"status": 401,
"error": "Unauthorized",
"message": "Unauthorized",
"path": "/daso/oauth/token"
}
}
Я использую почтальон для проверки API, почтальон использует заголовок Auth - Basic Auth (Имя пользователя - vcs-api-client, пароль - vcs-api-client)
{
"status": "SUCCESS",
"data": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiIwOTg3MjUwNTU1NSIsInNjb3BlIjpbInJlYWQiLCJ3cml0ZSIsInRydXN0Il0sImV4cCI6MTU2OTA0OTg1NCwidXNlckluZm9ybWF0aW9uUmVzRHRvIjp7ImN1c3RvbWVySWQiOjc3LCJjdXN0b21lck5vIjoiMTAwLTAwMDAwMTA2LTAiLCJwaG9uZU5vIjoiMDk4NzI1MDU1NTUiLCJjdXN0b21lclR5cGVJZCI6MSwidXNlclR5cGVJZCI6MywibmFtZSI6IkF1bmcgSHRheSBPbyIsImRhdGVPZkJpcnRoIjo3OTc5NjcwMDAwMDAsIm5yY05vIjoiMTAvVEhBUEhBWUEoTikxNDYxOTIiLCJwaG90b1BhdGgiOiIyMDE5MDkxOTA0MTAwMDQ4NC5wbmciLCJtZW1iZXJObyI6IjEwNiIsIm1lbWJlck5vVmFsaWQiOmZhbHNlLCJob3RsaW5lUGhvbmUiOiIrOTU5OTY5NzExMSIsImN1c3RvbWVyQWdyZWVtZW50RHRvTGlzdCI6W3siY3VzdEFncmVlbWVudElkIjozNjYyMDIxLCJpbXBvcnRDdXN0b21lcklkIjoyMDI0MTUsImFncmVlbWVudE5vIjoiMjAxOS05LTA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LTAwMDAwMDAwMTEtMCIsInFyU2hvdyI6MiwiZmluYW5jaWFsU3RhdHVzIjoxLCJmaW5hbmNpYWxBbXQiOjEuMEU3LCJmaW5hbmNpYWxUZXJtIjo5fV19LCJhdXRob3JpdGllcyI6WyJDVVNUT01FUiJdLCJqdGkiOiJlODBlNjRjMC0wYTM2LTQ0YTEtYWExMC04ZjhlZWI5NWY2NDMiLCJjbGllbnRfaWQiOiJ2Y3MtYXBpLWNsaWVudCJ9.PZkjznQn_AAnPJWEsK8nkq7atzADayt6FIiakgqNi8Y",
"expires_in": 7199,
"scope": "read write trust",
"userInformationResDto": {}
"jti": "fefa6a6a-ff7d-442d-b00a-b349c096cc20"
}
}