Third party login from gmail add on

42 views
Skip to first unread message

Dorabajji

unread,
Jun 22, 2022, 2:40:54 PMJun 22
to Google Apps Script Community
Hi,
Had anybody done external login for gmail add on.
is there any sample code or any contribution regarding it for guidance?

Clark Lind

unread,
Jun 23, 2022, 1:39:06 PMJun 23
to Google Apps Script Community
Can you add a bit more detail to your question like a use case?  Is the addon connecting to an external source, or are you trying to connect from an external source to an addon? 
If the latter, you might be able to use the REST API to connect to your script and take limited actions. 

Dorabajji

unread,
Jun 23, 2022, 4:39:23 PMJun 23
to Google Apps Script Community
Hi,
I am logging into the external source for checking the bookings already made, so as to add new bookings in the external website . 
since there is no password type in card service, i am looking for other options.

Clark Lind

unread,
Jun 24, 2022, 12:51:41 PMJun 24
to Google Apps Script Community
One idea is to have a "settings" function on the main (top) card. Users could then set a login password there, and you save it to User property service, that way only that user can ever access it. 

const userProperties = PropertiesService.getUserProperties();
userProperties.setProperty('pass', 'whatEverPasswordTheUserSet');

Then when you want to login, 
const userProperties = PropertiesService.getUserProperties();
var pw = userProperties.getProperty('pass')

and use it in your login script or urlfetch, or whatever.   

Hope that gives you some ideas to work with. This isn't the best method, and not very secure. 

Dorabajji

unread,
Jun 24, 2022, 5:18:58 PMJun 24
to Google Apps Script Community
Hi Cwl,
I have also done exactly same. but i don't know if they require ouath2 for verification.
i have one doubt. i have added a scope in consent screen. so my status is pending. now i am not getting unverified app, then how can i show client id in demo video.
do you have any idea about this?
and it shows pending for almost 2 months, after i resubmitted, but i haven't got any mail. is it normal?

Clark Lind

unread,
Jun 26, 2022, 12:44:42 PMJun 26
to Google Apps Script Community
Another idea to try, would be to create a completely different standalone script that logs into the 3rd party API and retrieves the information. Get that script working. Then publish that script as a web app. You then might be able to call the web app url, it logs in/retrieves, and then passes the response back to the Card that called it.  Just a thought to try. See what it takes to log into the other system. You could even publish the other script as a library instead of a webapp, and import the library into your project. All the above is just speculation, I don't know if it will work or not.

Dorabajji

unread,
Jun 28, 2022, 5:28:01 AMJun 28
to Google Apps Script Community
Hi Cwl,
This seems interesting. i have seen an addon which goes to webapp from the card.
But i have one doubt unlike addon , webapp will be deployed in ours, so would the no of users limit using the at the same time wont apply?

Clark Lind

unread,
Jun 28, 2022, 8:33:01 AMJun 28
to Google Apps Script Community
I don't think the number of users will impact it. I will play around with the concept and see if I can get it to work.
1) from card interface, open webapp.
2) from webapp, log into 3rd-party system
3) make request to 3rd-party system, get data   (all of this will depend on the 3rd-party API requirements)
4) return data from webapp to card    
5) update card interface with requested data 

Is this basically what you want to do? 

Dorabajji

unread,
Jun 28, 2022, 4:34:42 PMJun 28
to Google Apps Script Community
yes correct the same
Reply all
Reply to author
Forward
0 new messages