Hello, I’m Ulrich and new to thunkable and here comes my first question:
For getting data from an web api I need to place the Bearer token in the header of a POST.
Our Bearer token has a lifetime and i need to change it from time to time.
Therefore I need a method to set it and found this inside the web_Api ‘set headers’ method.
When I place the Bearer Token there I receive an 431.
When I use the same token just for trying directly inside the header within the design section it works fine.
So my question: why does the same thing in the design section work, while using the “set headers” methode inside the blocks does not?
no, sorry, I had a look. A bearer security token in the header is a string, not a json object (see RFC6750).
So i need to pass a string to the header with the set Web_API 's header to method which does not work - while passing the same string within the design part to the header works.
So my question: is the set Web_API 's header to working correct with strings as it should?
You are mistaken, JSON is a formatted string by definition. Programming languages prefer to encapsulate it into an object which is a totally different subject.
I tried delivering in json format and our server rejected with 431 Request Header Fields Too Large.
When sending “Authorization: Bearer mF_9.B5f-4.1JqM…” as a string within of thunkables design page it works. And in thunkables design page you may of course provide a string
Sending as object works in this case without passing string.
Problem was: the header application-type in the design page gets overwritten (of course) when you use the set Web_API’s header to method. Therefore you must provide at least both paramaters pairs: content-type + authorization.