我正在尝试使用FPL API进行身份验证 谁能在下面帮助我,我找不到错误的地方
这是身份验证指南https://medium.com/@bram.vanherle1/fantasy-premier-league-api-authentication-guide-2f7aeb2382e4
我收到此错误
状态:200
statusText:“确定”
url: “ https://cors-anywhere.herokuapp.com/https://users.premierleague.com/accounts/login/”
好:错误
名称:“ HttpErrorResponse”
消息:“解析过程中的Http失败 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);
});
}
}
答案 0 :(得分:0)
如果您访问为请求指定的URL,它将告诉您确切的问题:
缺少必需的请求标头。必须指定以下项之一:origin,x-requested-with