I am trying to retrieve the source code of a website/project which was made for me on fiverr. I've been made the owner of the project.
I followed the advice on previous links (below) to get the source code:
Is it possible to get the source code of a Google Firebase (or Google Cloud Platform) project?
Is it possible to retrieve Firebase Cloud Function source code?
Get code from firebase console which I deployed earlier
For some reason my google cloud functions list does not show “source” as stated in previous answers picure with source missing in functions list.
Is there another way to access the source code from google cloud?
Appreciated
J
So its been over a year and a bit more experience with Firebase. The correct answer is you cannot technically access the source code because the source code contains the html,css and javascript files which are deployed to the Firebase server and are back-end (server side). What you view on the website is only the front-end client side code and is not the full picture.
Whenever you get a website developed for you, you should always have the developer pass on all the html,css and javascript codes so that you can always deploy it when needed.
Related
I have a project in GCP with some internal APIs (in VMs), Databases, and so on.
Now, I'm trying to create a GAS to obtain data from one of those internal APIs (Druid, in my case) to print some data in a Google Spreadsheet.
My point here is that I link the GAS to my GCP project, expecting to be able to connect to my internal IP (10.1.0.x) which is in a VPC, shared with the default one. So, if I start a new VM attached to the default network, I could be able to ping and connect to it. Seems reasonable.
But, when I execute the GAS function, the following pice of code fails: UrlFetchApp.fetch('http://10.1.0.3:8082/druid/v2/?pretty', options);.
Should I configure something else in the GCP project to be able to connect to internal APIs?
Should I change the way and use another GCP service to do so?
Any help would be more than appreciated!
Thanks
That is not supported in Apps Script. You could request a feature request in the bug tracker. See https://developers.google.com/apps-script/support#missing_features
Internal APIs run client-side and need to be incorporated within JavaScript code.
Within Apps Script you can run JavaScript code, if you deploy your project as a Web App.
You can then either embed the JS code within the HTML file attached to the project, or directly insert it within the <script></script> tags within HtmlService.createHtmlOutput().
When attempting to embed Google’s sample provided for the Tasks API (code found here) into Google's Classic Sites I get the dreaded “script.google.com refused to connect”. The logging error is "Tasks" is not defined at getTasksLists(simpleTasks:15). Details:
When I embed this same script into Google's New Sites, the UI does show, but the drop-down continues to display “Loading…” (see screenshot below), however if I click on the link provided to view my “Google Tasks” it does go to my Tasks in a new window.
This runs successfully directly from Google Apps Scripts, showing the “Authorization required” pop-up and allowing me to sign in and accept permissions. However, when embedded into both New and Classic sites, it does not request any authorization.
Steps I've taken embedding into Classic Sites (where it needs to be):
from URL provided above: copied code exactly as is into a new Scripts project (nothing altered or added).
from Scripts: deployed it as a Web App, copied the URL provided (the code provided in the link above has not been altered in any way by me)
from Scripts: enabled Tasks API though Resources, Advanced Google Services
from Sites: edit page, Insert Apps Script, pasted URL (i.e. https//script.google.com/macros/s/...5Ym41qn/exec)
Other things I've tried:
from Sites: embedding URL as an iFrame gadget (same results)
solution given here: How to add Google Drive Scripts project into Google Sites? (same results)
days of research into Google's documentation (for Sites, APIs, Scripts, Cloud Platform, you name it)... (various results but nothing productive)
I am very new to working with Sites, Scripts, the Cloud Platform, etc. so apologies if I am missing some obvious steps here. Any guidance would be truly appreciated!
Leora
UPDATE [03-21-19]:
I was able to get this working finally! Although not posting as answer just yet as I haven't figured out the exact change that was brought success.
I thought it was by changing the option within Sites' Publish / Deploy as web app... / Execute the app as: from 'ME' to 'USER' (after doing that it worked), but when I changed it back to make sure that was it, it still worked?
I will play around with it more this weekend and update when I come to a definitive solution.
Thanks to anyone who took the time to help me out here, and if anyone does have any guidance on what's happening here, I'd love to know.
I hope someone has some insight into this issue. I'm trying to execute script in google sheets. The script runs fine when manually executed. We need to use service account for this purpose. API executable was published, I have .p12 file for authentication, there is only 1 function to run and we're getting the 404. I'm using some c# code from DEVs site and that should work as per the article. Has anybody else run into this? Is there an example that shows how to do it correctly? This is what i've based my code on, to no avail... https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth
Thanks for any ideas!
Edit: Thanks Ares - my specific problem is that while following devs example code, I can't execute google script and receive the before mentioned 404 error.
You cannot use C# in GAS. Google Apps Script is based on Javascript. The link you provided shows how to code an example in .NET, which is neither GAS or C#, so I'm confused at why you would follow that example at all.
Regardless, any code that can be used in a Google Script site will say that it is for a .gs or an HTML file.
Remember that Google has many API's that work across multiple languages. GAS is what they want to push, but not every guide they make is aimed at GAS.
I assume the 404 is from using unreadable code.
I'm trying to develop a simple web app using google script web app service and access it from another script using the UrlFetch service.
My problem is that in order to try the code on my web app I have to publish a new version every time because trying to access to the dev URL returns returns and HTML file telling me to sign in even though I've set the permissions for the web app to everyone, including anonymous (if I hit the production URL it does work, though).
I'm assuming that Google is limiting the access to the dev URL for security reasons but can someone shed a light on that assumption?
PS: I don't know if this is relevant but my google account is in a Google Apps for Education domain
Edit
I've found a method to avoid publishing the application for each code change: instead of calling it from the UrlFetch service, I've created a function in the web App code that does call the doPost or the doGet method (I've to create the request param, but that's easy) and I've changed the end of the script to log the result insted of returing it to the client. When the application will be ready, I can publish and develop the client using the UrlFetch.
Anyhow, if anyone knows about the limitation of the dev URL that would be great!
your assumption is correct, the dev url ignores your publishing permissions on purpose, only the developer has access to that url.
you could accomplish what you want using libraries. move the code in your called script to a library and add it to that script as "development mode" and publish your script service.
changing library code should also change your service because its on development mode.
Note that this can easily break your app if you save partial code changes, and makes it hard to test your changed code unless you make all changes and tests in a separate script copy. Making several changes at once in multiple apps script editor files is possible with their "Save all" File menu command (after manually pasting all code changes from your tested copy).
I am new using google scripts and drive-sdk.
I'd like to call the copy functionality of drive-sdk. When I try it, I get a message that says I need authentication.
Where can I find an example of how can I authenticate from a google script to authenticate de drive-sdk?
Thanks in advance.
Biagio
Have a look at the Google's Drive SDK docs regarding authentication.
https://developers.google.com/drive/quickstart-php is a good example in PHP. other languages they have quickstart examples for: Java, Python, .NET, Ruby, Javascript, Go, and Objective-C/iOS
First, view Google's information on authorising with the Drive API.
Then, choose which language you wish to use, I would reccomend JavaScript (or Node.js) if you want to play around or are making a web app.
If you wish, you can view a simplified explanation of the OAuth2.0 flow.
To clarify, the basic steps you can use to get going in JavaScript (as an example) are:
View this official Google getting started page
Set up the Drive API in the Google Developers Console
Copy the code from the getting started page
Ensure you place your ClientID from the Google Developer console into the copied code
Install Python if you haven't already (version 2 or 3)
Start the web server using Python (python -m SimpleHTTPServer 8000 for version 2) and load 'http://localhost:8000/quickstart.html' into your web browser