Reputation: 1557
In order to perform some requests on my API, I need to send an Authorization header on my GET and POST requests.
Do you know if it is possible to do it on AMP?
But I can't find a way to send the Authorization header
.
Upvotes: 3
Views: 924
Reputation: 10917
We can't add header to requests in AMP HTML. There are 2 solutions to this problem:
1- Fetch data in server side: We can call API with own headers in server side and haven't any limitation for that. Then server return AMP html with own fetch data.
2- Change API (or wrap API to new interface) to handle authorization with cookie: We can set cookie with Http Headers that returned from API call so If API set cookie we can perform requests and cookies automatically send with own requests and no need to handle it in client side.
Upvotes: 1