Fetch json with token

Hi :wave:
I’m new here and seeing that i can use my external API was really great!
but my API require a user-token in the headers of the request. is this possible to achieve?

I’m not sure if anyone has ever cracked it, but we discussed about it here.

Maybe a javascript column that sets the headers and calls the API?

1 Like

Never had a reason to try it, but yeah I expect that would work.

2 Likes

Yeah, not something I’ve needed to do within glide either…yet.

i saw this in the threat you linked @ThinhDinh
“requires the token to be sent in headers”

i have searched but no one have did it before.
if someone is able to achieve this then i will use glide for sure.

i will be able to use my backend server with this approach and make all sort of server logic :+1:

Hola!

I think it’s possible but if you share your cURL command (or Fetch syntax) we can try to fix it.

Your JS code might look like:

var data= await fetch('YOUR_URL', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Authorization': 'YOUR_BearerToken'
    },
});

const json = await data.text();    //  or  data.json();   
return json

Saludos!

7 Likes

this is awesome!
i will give this a shot

Hi Mohammad,
Did it work for you? If yes, I also try it.