I am trying to put up a request on OPS V3.2 from a javascript application running in my browser (firefox).
I send a first request using the fetch API :
Code: Select all
fetch('https://ops.epo.org/3.2/auth/accesstoken',
{
method: 'POST',
headers:{
'content-type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic ' + window.btoa(userkey+':'+secretkey)
},
body: 'grant_type=client_credentials'
}
)

However, when I try next to send a POST request using the same method
Code: Select all
fetch('https://ops.epo.org/3.2/rest-services/published-data/{publication}/{epodoc}/biblio',
{
method: 'POST',
headers:{
'Accept': 'application/exchange+xml',
'Authorization': 'Bearer '+ token
},
body: 'EP1000000.A1'
}
)
I get the 403 code error with X-Rejection-Reason:AnonymousQuotaPerDay on the "pre-flight" request, i. e. when firefox tests whether the server is cross-domain compliant. Obviously, I get afterwards a networking error stating that my request does not satisfy the cross-domain policy and Firefox does not send the main request.
I get the feeling that my credentials are ok, since in the first request, I can see my email adress in the answer body (under developer.email). Then why would I be treated as anonymous?
Can anyone shed some light here ? That would be most appreciated.
Best regards,
JB Dargaud