我正在尝试使用 FPL api 进行身份验证 谁能帮我解决以下问题,我找不到问题所在
这是身份验证指南 https://medium.com/@bram.vanherle1/fantasy-premier-league-api-authentication-guide-2f7aeb2382e4
我收到此错误
status: 200
statusText: "OK"
url: "https://cors-anywhere.herokuapp.com/https://users.premierleague.com/accounts/login/"
ok: false
name: "HttpErrorResponse"
message: "Http failure during parsing for https://cors-anywhere.herokuapp.com/https://users.premierleague.com/accounts/login/"
import { HttpClient } from '@angular/common/http';
constructor(private http: HttpClient) {}
getData() {
const proxy = 'https://cors-anywhere.herokuapp.com/';
this.http
.post(${proxy}https://users.premierleague.com/accounts/login/,
{
redirect_uri: 'https://fantasy.premierleague.com/a/login',
app: 'plfpl-web',
login: 'my-email',
password: 'may-pass'
}
)
.subscribe((data) => {
console.log(data);
});
}
}
最佳答案
如果您访问为请求指定的 URL,它会告诉您问题到底是什么:
Missing required request header. Must specify one of: origin,x-requested-with
关于javascript - 使用 JavaScript 和 Angular (HttpClient) 进行 FPL Api 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59384373/