我正在尝试按照您的步骤连接到您的 API,但我真的不知道如何启动身份验证...第一次尝试是通过 AJAX 进行 Javascript 通信,所以这里是它的代码:
$.ajax({
url: 'https://api.clockify.me/api/auth/token/',
method: 'POST',
cache: false,
contentType: 'application/json',
headers: {
'X-Api-Key': 'MyAPIKey'
},
data: { "email": "MyMail", "password": "MyPass" },
always: function(r){
console.log(r);
}
});
不断响应我得到这样的错误:
{"message":"Could not read document: Unrecognized token 'email': was expecting ('true', 'false' or 'null')\n at [Source: java.io.PushbackInputStream@5cfd6511; line: 1, column: 7]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'email': was expecting ('true', 'false' or 'null')\n at [Source: java.io.PushbackInputStream@5cfd6511; line: 1, column: 7]","code":3002}
接下来,我尝试继续从 PHP 开始通信并使用 CURL 进行身份验证和所有操作,但我一直遇到相同的错误/问题。
有什么我想念的吗?