Load WebView URL with headers/cookie data

Hey guys! What’s up?

I’m building my app, most of it will be native, making calls to a PHP backend and building the interface with fuse.

In some pages, like “My Account”, for now I would like to use the WebView and load a web page into it, but I have to specify a cookie/session token when making the GET request, so my webserver knows what user is requesting the information, in order to deliver the right data.

I already have this token in a SessionHandler variable, and I use it to make all API request, like this:

fetch("https://api.mydomain.com/getInternalMenuItens", {
        method: 'GET',
        headers: {
            "Cookie": "UserToken="+ _SessionHandler.token
    .then(function(result) {
        if (result.status !== 200) {
            debug_log("Something went wrong, status code: " + result.status);
            errorMessage.value = "Oh noes! :(";
        return result.json();
    .then(function(data) {
    .catch(function(error) {
        debug_log("Fetch error " + error);
        errorMessage.value = "Oh noes! :(";

My question: Is it possible to send this token in the header request of WebView request?
Or build an iframe or something?


Hey Jaison!

WebViews are their own world, what happens in a WebView tends to stay in a WebView unless you rig some sort of bridge of your own. As a first step you can generate HTML in JS and pipe that to a WebView through <WebView Source="{mySource}"/>

Hey, Andreas. Thanks for the answer.

Since it’s not possible in a native mode with WebView, I am thinking about generating a hash and pass through the URL in WebView, and code something into my backend, in order to recognize the request and deliver the right information.


That sounds like a better approach! When possible, solve it in the backend :wink: