Can i use Google app script for developing google chrome extension - google-apps-script

Can we publish google app-script code in to a chrome extension tool. So far we developed a web app from app-script, which is working as a web application. What need to be done to convert it in to a chrome extension from google app-script Editor. Appreciations are shared for valuable suggestions.

I've developed both GAS Web Apps and Chrome Extensions and I can say with certainty that you cannot use Google Apps Script's GUI editor to develop a Chrome extension. They are two very different beasts.
For one, Google Apps Script, uses its own flavor of server-side javascript. Plus it leverages libraries and services unique to its platform.
A Chrome extension uses client-side javascript and it too has its own libraries and services.
Moreover, they handle user authentication a bit differently (even though they are leveraging the same OAuth2 flows under the hood).
But you might be able to integrate the two. You should be able to make POST requests to a Web App from a Chrome Extension, so that's one approach.
However GAS scripts are limited by quota restrictions so you might be better off rebuilding your app from the ground up as a self-contained Chrome Extension (the better option in my opinion).

Related

Access browser cookies from Google Apps Script

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?
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.

Can I use Web APIs in chrome apps

I want to use web workers in a chrome app I plan on creating. But not certain if I can use all web apis in chrome app (or in this case web workers).
So my questions is: Can I use all web apis that the chrome browser can use in chrome apps
So I found the answer to it just a few minutes after posting this question
According to the Web API section in the chrome apps documentation:
In addition to the chrome.* APIs, extensions can use all the APIs that the browser provides to web pages and apps. If the browser doesn't support an API you want to use, you can bundle additional API libraries into your extension.
Don't worry about the term 'extension' in the quote above, it seems the documentation was copied from the extensions' web api section.

Chrome extension or chrome app?

I would like to create an extension or app for the Chrome browser which would require access to a user's Google Calender (for creating new appointments).
I am unsure of which technology to better research and use, Chrome extensions or apps. My "app" wouldn't need much of a GUI, so I'm leaning towards extension — but I don't know if this would pose any difficulties for accessing a user's Google Calender to add an event.
Anyone one have any idea which technology is best for this situation, and why? Thanks!
Either, or... Go with an extension if you'd like.
I assume you've looked at the API reference?
https://developers.google.com/google-apps/calendar/
From there, I'd imagine you'd just need OAuth to authenticate the user. Here's the JS library:
https://code.google.com/p/google-api-javascript-client/
There are pros/cons of each types, apps or extensions.
Apps
If you would like to create a client application of Google Calendar which has many rich GUI components, this type will become a better solution.
In addition, Chrome apps can communicate with many hardware devices and other servers. Of course, your Chrome app can become as a server (that is, your app can open a server socket and accept a request from other client apps).
Chrome apps can be executed not depending on your Chrome Web browser. That is, Chrome apps cannot access to a context of your Chrome Web browser.
Probably, you don't want to get the pros above, I guess...
Extensions
If you would like to create a small UI for posting your schedule to Google Calendar, this type will become a better solution.
In addition, Chrome extensions can access to a context of your Chrome Web browser. That is, your extension can get page contents of each tab and inject your CSS and/or JS code. For example, your extension will get a URL of some opened tab and include it in a body of the posted schedule.
Chrome extensions completely depend on your Chrome Web browser. That is, your extension cannot execute independently.
Also, generally, high cost will be needed to develop Chrome apps than Chrome extensions. As the result, you should choose Chrome extensions, I believe.

Implementing OpenID authentication with Google Apps

Very related to this question: SSO, using Google Apps user database but I'm wondering how the user Nil started off with his OpenID script.
Could anyone give some background on this? I'm not very familiar with OpenID.
The Google Apps Marketplace Google Apps Platform Single Sign On overview provides all the information you need to get started. Since #Nils describes a Corporate Google Apps environment, it's very likely that this is where they went to start their implementation, since...
For in-house apps developed with the Google Apps extensions console, implementing Single Sign-On is a strongly recommended best practice.
You'll find background information and links to existing OAuth libraries in a variety of languages.
You should also look at the Google Identity Toolkit, which provides an API you can use to implement SSO for your web app, as well as a Javascript widget you can incorporate to make the task simple.

App built using Google Drive PHP SDK keeps redirecting to the same page

I'm following this guide to create a sample web app which implements the Google Drive PHP SDK.
When I access the URL, the app keeps redirecting to the same page in an infinite loop, so no content is shown actually. Any idea why this is happening? Is it due to some mistake I made in the config file?
The document says how to implement the sample app - called DrEdit - as a Google Chrome application. Can anyone tell me if it is possible to use the SDK for creating non-Google Chrome apps? Also, does anyone have any example implementation of the Google Drive SDK?
If you provide more information and code, we can debug your first issue.
Otherwise:
Yes, you can write apps for Drive that are not Chrome apps. Chrome Web Store is an optional distribution mechanism for the API. Your apps will work in any browser.
There are documented PHP snippets for every API method, e.g. https://developers.google.com/drive/v1/reference/files/get