Help retrieving iframe authorizationUrl

46 views
Skip to first unread message

Javi Garcia

unread,
Dec 7, 2021, 7:37:54 PM12/7/21
to Google Apps Script Community
Hi all, I have a button that on click opens an iframe with a given authUrl. The code is:

  var service = getOAuthService();
  var authUrl = service.getAuthorizationUrl();
  var authButton = CardService.newTextButton()
      .setText("Login")
      .setAuthorizationAction(CardService.newAuthorizationAction()
      .setAuthorizationUrl(authUrl)).setTextButtonStyle(CardService.TextButtonStyle.FILLED);

The button opens an iframe on a separated window wich authenticates a user in a certain service, but I need to embed this iframe on my gmail
addon, so the authentication method is done through the addon.

My idea was to retrieve the URL of the iframe to show it on the addon using the HtmlOutput and <iframe> tag,
but debugging the code (Logger.log(authUtl)) the given URL doesn't match with the Url of the opened iframe.

Iframe Url has 2 parameters, but only 1 is stored in authUrl variable:

...../auth?code=XXXXX&state=YYYYY ----> State is the parameter registered in authUrl variable.


Any ideas to solve this, or some other method to embed this process in my addon??

authUrl has a response_type=code in case this could help.

Best regards and thank you.

Clark Lind

unread,
Dec 13, 2021, 11:54:16 AM12/13/21
to Google Apps Script Community
Reply all
Reply to author
Forward
0 new messages