0

I have an api where you need to have a valid json web token to upload an image:

For example, I make a post (with the Authorization header to this url) to upload a photo: http://localhost:3000/api/account/events/54f9b55254fb9f32306a26dd/sponsors/54fdb4212f67981b1f6a8665/logo

If I want to fetch an image I'll do a GET request to the same url, however, this won't work when using JWT because I can't send an Authorization header when fetching an image.

Is there a solution? The image cannot be made public until the user authorises it.

4

1 回答 1

1

Authorization目前尚不清楚为什么在发出 GET 请求时不能发送标头。谁在提出这个要求?是否要使用 HTMLimage标记加载图像?

如果是这样,您需要向您的站点添加授权,并将src该标记的属性指向您站点中受 cookie auth 保护的资源。然后,您可以让该资源实现使用 JWT 令牌调用您的 Web API。

于 2015-03-11T02:11:22.903 回答