How to display external API Oauth Dialog for Google Sheets AddOn - api

I'm playing around with building an app to integrate a 3rd party API into google sheets using app script and the new AddOn API's for google docs. I've got the Oauth2.0 flow working by adapting this code here. This works, but I don't want this app to be a standalone web app - I just want to add another menu with a few select functions - one of which will be authenticate to the spreadsheet. I have this working in parts (1. new menu with authenticate button that runs a function when clicked. 2. Url that starts Oauth process when I hit that specific URL in a another window), I just am not sure how to connect them.
My problem is that I'm not sure how to display the 3rd party API's Oauth dialog in a way that is integrated with Google Docs. I've tried loading it into a sidebar, but that doesn't seem to be working. Is there a way to open a 3rd party Oauth2.0 dialog with app script?
This is my first interaction with app script but It'e been pretty easy and painless so far. I'm just wondering what the best way to approach this problem would be.
Thanks!

There is no built-in way to do a 3rd party OAuth2 flow using Google Apps Script. However it is possible to write an OAuth2 flow on top of Apps Script, and this library is one such implementation:
https://github.com/googlesamples/apps-script-oauth2

Related

Google App Script - 3rd party (Zoho) OAuth flow

I'm trying to build a web app using Google App Script which retrieves project data from Zoho projects. Zoho API uses OAuth 2.0 - see here: https://www.zoho.com/projects/help/rest-api/get-tickets-api.html
I'm trying to figure out what the flow of authentication is here, when using App Script.
How do I display the OAuth permissions dialog for the user?
Do I need to redirect (redirect_uri) to another App Script to deal with the ?code= and do the actual API calls? Or should I redirect to same script and have a check for ?code= query string at the start of the script?
How do I deal with the refresh token, when auth needs refreshing?

How can I create OAuth based login with Open AI api?

I'm trying to build an app using GPT3 APIs and would like users to login to the app using OpenAI's credentials so as to use their account for GPT3 APIs requests, however there is no support for 3rd party login so far in Open AI's documentation. Anyone has ideas on how this can be done?
As far as I'm concerned Open ai does not have an oauth API like Google (for example). The only idea that occurs to me is to ask the user for their Open ai Api key and make the requests through that key

Xamarin Forms (iOS) - share cookies between application login and Microsoft PowerApp

Currently I'm trying to create an App in Xamarin Forms that shares its login session (logging-in with Microsoft) with a webview that contains a Microsoft PowerApp (as my application, it uses Microsoft account to login).
I just created a custom webview and a custom webview render. In Android custom render I used Android.Webkit.CookieManager.Instance.SetAcceptThirdPartyCookies(Control, true); to accept third party cookies and it works well.
But I'm having trouble with iOS where I couldn't find a similar way to accept third party cookies and I can't go through it. I've already tried to use NSHttpCookieStorage.SharedStorage.AcceptPolicy = NSHttpCookieAcceptPolicy.Always; but it didn't work for me.
I'm not using Xamarin in a long time, so any help will be really appreciated.
Thanks
S.

Google Photos REST API with Angular/Java/dotNet

I am trying to connect to google photo in angular and been searching since last two days about google photos REST api but couldn't find any useful example.
Could somebody help me with this on how to use google photos api in angular. an example would be great if I get it working I will creating sample and put it on github or others to look at.
Another thing I am trying is to connect api without any user interaction. I have tried playgrounds but its prompting to authorize access as well. Idea is to build ionic app that can connect to my google photos without needing me to authenticate access to it with my id and secret.
my app would be in angular(ionic) or java(android) so would prefer example (if any) in those platform but ok with dotnet or php as well. Won't be able to use library in dotnet or php.
Thanks
Bhavesh

Google Plus API - Retrieve code programmatically

I'm using Java with Google Plus API. I'm using OAuth 2.0. When a user is authenticated, an access code is returned in a browser. Now, given that the code must accompany a call to the Google Plus API, I currently have to manually copy the code and use it in making calls to the Google Plus API. What I wish to do, however, is to programmatically retrieve this code; eliminate the manual copying.
Any assistance will be highly appreciated. Thanks in advance.
It sounds like you're writing a command line or some other non-web application that uses the Google+ API. This throws a little bit of a wrench into the token delivery via HTTP redirect. Without the redirect there's no way for the OAuth web pages to communicate with your code and hence you must copy and paste it.
There is one work around that seems to work pretty well. You can set up a local web server, such as an embedded Jetty, and complete the OAuth flow by redirecting the user back to their locally running web server.
You can see an example of this implemented in oacurl which is hosted here: http://code.google.com/p/oacurl/