Вопрос

The Asana API conveniently allows to return results in the form of JSONP, rather than JSON, in order to circumvent the same origin policy for in-browser scripts. However, the documentation says that JSONP is only allowed when authenticated using Asana Connect. That's all well and good, but to use this authentication method, one must attach the obtained "access token" with every request, by adding the following HTTP header,

"Authorization: Bearer ${access_token}"

yet it is not possible to attach arbitrary headers to JSONP requests, the way it is possible to do for normal XHR.

The README of the oauth example provided by Asana says of the access token:

This token can then be used to access the API, in this case typically using JSONP.

But how? Is it somehow possible to include the access token in the query string?

Это было полезно?

Решение

You can now attach the authorization header in a URI param called auth_bearer_token. Hope that helps - and please respond if you have further issues with that.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top