403 The caller does not have permission & Request entity was not found - google-apps-script

If you're getting errors for Google App Script API:
403 The caller does not have permission. Permission_Denied Forbidden
Request entity was not found
The answer below should remedy the issue.
If you find this helpful, please remember to contribute to hard-to-find issues especially for Google API services since they're often poorly documented and solutions are not complete (I usually find workarounds that are not secure).
Edit: I feel the possible duplicate link goes more in depth on one issue. This post has 2 key phrases and it solves them quickly. If the visitor feel they need to go more in depth, then the possible duplicate link would be a good choice: How to run Google App Script function from Google OAuth 2.0 Playground | The caller does not have permission
I've also searched thoroughly using the key phrases of the issues but I couldn't find any that solves it satisfactorily. The answer also tells the user that they don't need to share their document publicly and no service account is needed which I feel is important. The conciseness of the answer I feel is helpful. Though I will close this post if there's a helpful explanation on why it should be closed.

First go into your script:
Publish > Deploy as API Executable > New > Update > Close
Resources > Cloud Platform Project > Enter Project Number (https://console.cloud.google.com/home/dashboard) > Set Project > Close
Enable execution API on developer console.
Check if your credentials.json is for the correct project.
Note: I find many solutions that share the document to public and also a service account requirement, this is not required.

Related

Github Automerge Failure Notification (API v4 GraphQL mutation enablePullRequestAutoMerge)

at my company we want to make use of the relatively new API feature "Automerge" (not through a UI but through an API call),
However we can't seem to find any documentation of a webhook (or other asyc way) of finding out if a merge request failed and why,
anyone know a way to receive such a notification?
Thanks! :)
Hope this saves some work for someone out there,
we asked Github.com support directly and they said there was no async / webhooky way of doing this (as of Nov 2021).
Here's a quote from the support person when asked if there were a way to find out, here's what they wrote:
There wouldn't be a great way to discern that (reason for failure) and
it may be better when you see that, to use the REST API to Get the
Pull Request to get some additional information.
looking at the documentation as suggested in the quote above it seems that through the "closed" action and "merged" key one could discern whether a merge was successful or not, but without any further information about the failure.

Authenticate non-Google account in Chrome extension using OAuth2

It seems like chrome.identity.launchWebAuthFlow is the way to go. I found resources that explain how to implement it client-side but they all say nothing about how to authenticate server-side for non-Google accounts:
"The provider will perform authentication" - how?
"Validation of the returned access token isn't shown here"
It seems that the last missing ingredient is to write server-side (ideally Python) code that listens on my app's server and validates URLs such as:
https://www.my-app.com/dialog/oauth?client_id=123456789012345&redirect_uri=https://abcdefghijklmnopqrstuvwxyzabcdef.chromiumapp.org/provider_cb&response_type=token&scope=user_photos
I'm guessing that would be done by another Chrome Identity API call from my application's server. I looked through a large number of resources (and related stack overflow questions) and they provide no clear answer. Thanks!
[migrated discussion here from this question]

LinkedIn API v2 integration

I'm trying to integrate LinkedIn API v2 to the app I'm developing for my client and I need help with it. Basically, I need to allow users to fetch some of their LinkedIn profile data and save it to the platform. As I understood, the first version of the API will no longer be supported. https://developer.linkedin.com/docs
So, the problem is that the default field set I was able to retrieve is extremely limited. And it seems like I should apply for the Developer Program here to gain additional API access
https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program
I already submitted the application but haven't yet received any response. The frustrating part is that I'm not even sure if this is what I should do to get access.
Here's what I already discovered
Here it's said that the partner's program isn't available
https://www.linkedin.com/help/linkedin/answer/97491
Here it sends me to the partner program
https://developer.linkedin.com/support/faq
Should I choose marketing? https://developer.linkedin.com/partner-programs
I suppose so because other options seem to be irrelevant. So I already applied here
https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program
But still no answer
Here are the developers facing the same issues with no answer as well
https://www.linkedin.com/help/linkedin/forum/question/712591
https://www.linkedin.com/help/linkedin/forum/question/711176
https://www.linkedin.com/help/linkedin/forum/question/711027
Here seems to be the answer to a similar question but still, no specific link or steps to apply for a partner's program
LinkedIn API V2 - Can't get summary, skills and headline
Here they also tell about some partner's program but again without specifics
Linkedin oauth2 r_liteprofile not being returned from api
Here in the official doc, it's also said that I should apply to the program (which I did)
https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context
I applied on the 23rd of January and I'm still waiting for the approval without even knowing if this program will give me the API access I need
So I need to know one of the following
If my application will be approved it'll give me the extended access to the API v2 (r_fullprofile permission)
If the application I submitted isn't enough what else should I do in order to get the extended access to the API v2 (r_fullprofile permission)
It feels to be a simple process and I don't really understand why it has to involve the Marketing Developer Program when I only need to access some of the fields. I'm sure there is a reason for that. Could anybody from support provide some steps that I or my client should take on order to get the API access?
I already created the app as a developer here and successfully tested it
https://www.linkedin.com/developers/apps
So, just to be clear, the problem is not in something not working technically. It's just that I receive a very limited set of field of a user's profile and I need to expand it

Access Google Drive API without creating WebApp?

First I apologize if I'm a dolt and am missing something obvious, but I've spent a few hours scouring documentation and am lost.
I'm trying to write a python script that will upload a bunch of images to a single user's Google Drive. The user already exists and will never change. I am not writing a web app and don't plan to use any user interface whatsoever. Everything will be done through code.
As best I can understand from the Google documentation, I have two choices:
1) Write a web app and register it to use the Drive DSK. This of course requires having urls and such for the web app.
2) Create a service account, which ties my "app" to a new service account email.
Neither of these options works for me. Is there any way to simply log in to a single user account and access their drive through python scripting?
There is a deprecated API called ClientLogin that would enable you to use the username and password for a login to access that Drive data.
But the basic idea is that you should be using something more secure -- from your users' point of view -- that allows them to authorize you without giving you their password.
For your use case it is possible that the user is you or someone you know and that you are accessing their account through a more personal kind of authorization. In that case, ClientLogin may be your best choice. If this is an application designed to be used by arbitrary users, the deprecation of ClientLogin is for a good reason and I would urge you to bite the bullet and choose one of the supported options.
The correct solution is to separate the authorization phase from the access phase. The authorization process needs to be run one time only, and can be done from a simple web site. The result of this is a refresh token which is analogous to a username/password. You will need to be aware of the security implications. Make sure you only grant drive.file scope to minimise the impact of a security breach.
Since you are uploading images, you might also want to look at the picassa api.

Google CRUD Migration from SQL API to Fusion Tables API

I used Ferris Argyle's CRUD from the Google Apps Developer Blog and now must migrate this SQL API to Fusion Tables API. The full code is here. So far my efforts have left me with a code 404 error and lots of this:' <HTML><HEAD><TITLE>Not Found.' Ideally this example CRUD would be updated by Google but lacking an update perhaps someone could offer guidance.
What i've updated from the migration guide.
Turned on API, Removed numberic ID's, Updated libraries (None for me), updated URL end point.
added '&alt=csv' to query parameter.
added '&key=MyEncriptedAPIKey'.
I am unsure if OAuth in the CRUD must be updated.
I am unsure of the relationship between API Key and OAuth, do i need both or one.
Can anyone look at the example CRUD and tell me what i'm missing? i'm a novice with Javascripts, Google Apps, OAuth so examples or links are welcome.
thanks,
Scott "if it ain't broken don't fix it" B
Unfortunately Google Apps Script doesn't currently doesn't have native support OAuth2 authentication, which is required to by the new Fusion Tables API to access private data. Some users have had success implementing parts of the OAuth2 flow themselves in Apps Script, but as a novice this may not be feasible. If you are only accessing public data then you should be able to get by just using the API key.