Error 401 using Metabase API Session Token in Google Apps Script

137 views
Skip to first unread message

Domarys da Silva Corrêa

unread,
Oct 29, 2021, 2:32:00 PM10/29/21
to Google Apps Script Community

Hello,

I coded a script in Google Apps Script to catch some Metabase data and write it on a Google Sheet. When I make the login using my credentials the function work and I receive the Session Token.

But using the token in the script to access my cards the error 401 Unauthenticated is shown.

var headers = {
"method": "get",
"contentType": "application/json",
"X-Metabase-Session": "22222222-cccc-4444-9999-333333333333",
"muteHttpExceptions": true
};

Logger.log(headers);
var response = UrlFetchApp.fetch(url, headers);

I test the url and session token in my local terminal using curl command and it works normally. The Google Apps Script is almost authorized and doesn't inform any error. Does someone have any idea?

Reply all
Reply to author
Forward
Message has been deleted
0 new messages