6

I am new to Google Addon development. I have been working to develop a Gmail addon using the Google Apps script.

My current requirement is to retrieve some information from a website which is authenticated in the same browser (in a different tab). The website supports different authentication types (SAML SSO, Active Directory etc) and require multi factor auth. So it is not possible (or practical) to perform all types of authentication from the Apps Script.

Instead, My idea was to have the user login manually (not the addon script itself) into the site (using whatever authentication is configured for the user) . The login action results in authentication cookies stored in the Browser. I want use those cookies in this Addon script to perform API.

This works fine with chrome extensions.

So, My question is, is it possible to retrieve stored cookies in a browser using the URL name from the Apps Script?

Rubén
  • 34,714
  • 9
  • 70
  • 166
rydgaze
  • 1,050
  • 13
  • 24
  • Yes, it's possible. Have you tried researching this topic? There are a number of articles and script examples available. – ross Jun 27 '19 at 11:04
  • 1
    Possible duplicate of [Cookie handling in Google Apps Script - How to send cookies in header?](https://stackoverflow.com/questions/10869932/cookie-handling-in-google-apps-script-how-to-send-cookies-in-header) – AMolina Jun 27 '19 at 13:18
  • 1
    Nope, it is not a duplicate. All those are explain on saving cookies from a response of a urlfetch call. That is not what I am looking for as I explained in my post. – rydgaze Jun 27 '19 at 18:58

1 Answers1

0

This is strictly not possible. Google Apps Script code does not run in the browser. Although Apps Script shares many conventions and similarities with frontend (browser) development, it actually runs in a sandboxed environment on Google's servers, so it is not possible to access the standard web APIs that you're used to when developing for the browser.

Adam Stevenson
  • 657
  • 3
  • 11