Google Drive HTTP 403 “Access Not Configured” error - javascript

I'm attempting to install the DrEdit sample app for Salesforce onto GAE. The app runs, but saving or opening a file results in an HTTP 403 "Access Not Configured Error".
I have also attempted to use the values for API Access>Client ID for web applications. The Google Drive SDK> OAuth Client ID has also been set variously to the Drive SDK and web app Client IDs. but, After enabling both (Api, SDK) in Api access service i am still getting same error.

Can you make sure that you register your application on the Google APIs Console and enable the Drive API and SDK for it first?
It's all described here: https://developers.google.com/drive/register
Then make sure that you use your Client ID and Client Secret in DrEdit's configuration file.

Related

Google Cloud Storage Angular App Hosting 401 Error on Hosting

I'm trying to deploy an Angular app to a Google Cloud Storage bucket so that I can serve the app from there. The bucket has public access and is named so that I can serve it as a custom website via CNAME (let's say test.example.com). The bucket is also configured to map the main page to index.html and the 404 handler to index.html. When loading https://test.example.com, most of the app loads fine, but any of the assets that are loaded via XHR (GET from /assets/) get an HTTP 401 error. There are no preflight requests. I've tried setting various permutations of CORS settings on the bucket, but nothing seems to help.
I am getting this on loading on assets.
<?xml version='1.0' encoding='UTF-8'?><Error><Code>AuthenticationRequired</Code><Message>Authentication required.</Message></Error>
Can anyone help me out.
We are using Google Cloud Storage and Google DNS Hosting for this.
Any request your application sends to the Cloud Storage JSON API that requires authorization needs to identify your application to Google.
You can identify your application by 2 ways:
Using an OAuth 2.0 token (which also authorizes the request)
Using the application's API key
Please follow the steps in the Documentation linked above to use whether Oauth 2.0 token or API key.
Let me know if it works for you.

Google signin: Permission denied to generate login hint for target domain (javascript web app)

I'm using the Google signin Javascript API (that is, the gapi-signin-button) on a webapp. The app is served by a gulp server, binding to 0.0.0.0. The login process works when I develop locally, but when I run on a remote server and access the page via the public IP, I get the following signin error:
Error: invalid_request
Permission denied to generate login hint for target domain.
I have both localhost:PORT and SERVER_IP:PORT in my Authorized JavaScript origins. Other SO answers have said I should be binding to localhost instead of other interfaces, but that doesn't apply here since if I bind to localhost the server can't be accessed remotely. What do?
I had this same problem and just figured it out. You can't use numerical ip addresses (like http://0.0.0.0) as redirect uris in Google. It has to be an actual url, like http://mycompany.com.

Calling REST service from Apps for Office task pane app

I'm playing around with Apps for Office, an Excel TaskPane app.
I'm using AngularJS if that matters.
When I call my REST service build with WebApi I get access denied errors from the javascript.
I've read up on JSONP and CORS and enabled CORS in my REST service but to no help. I can't even see the request hitting my service or leaving Excel in fiddler.
In the app manifest I've tried to add my REST service to the allowed AppDomain's but this don't help either.
So is it possible to to call a cross domain REST service from an Apps For Office TaskPane app in Excel?
If so how?

Google cloud print API key

I would like to call /search api from javascript client side. To do so, I have read that I need a oauth2 access token.
Following the Google guide, I must go to Google cloud Console but there is no Google Cloud Print service to subscribe to.
What service should I use to obtain an API key?
I recently started getting familiarized with both Google Cloud Print and OAuth, so I don't know much. I started in the same way that you seem to be starting. That is, by trying to make a successful request to /search. I will describe what worked for me.
After creating the project in the Cloud Console, I went to APIs & auth > Credentials menu item and created a new client ID for a 'Web Application' application type.
For the created client ID, I modified the Javascript Origins and the Redirect URIs appropriately.
Then, I added an anchor to the following URL in my web application so that the user gets directed to the authentication page.
https://accounts.google.com/o/oauth2/auth?
response_type=token&
client_id=<application-client-id>&
scope=https://www.googleapis.com/auth/cloudprint&
redirect_uri=<application-redirect-uri>
client_id - should be the client_id value of the Client ID that you registered in the Google Cloud Console.
response_type - This value would depend on what kind of application are you planning to develop. For client side applications (JavaScript apps), token should be the value. See https://developers.google.com/accounts/docs/OAuth2 for more info on this topic.
redirect_uri - should be the redirect URI value that you specified in the Client ID that you registered in the Google Cloud console. This is where the user will get redirected when it gets authenticated.
scope - I set it to https://www.googleapis.com/auth/cloudprint. This value will request that your app be given access to manage the cloud printers associated with the user account that is being authenticated.
Now, the part where I got stuck is when trying to make the HTTP request using JavaScript (AJAX) to https://www.google.com/cloudprint/search. I get the follow response when I attempt to make the HTTP request to /search.
OPTIONS https://www.google.com/cloudprint/search No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
It seems like the entity (server(s)) that is handling the request to the /search interface is not configured to use CORS? Correct me if I am mistaken.
Now, the way that I verified that I was able to successfully authenticate was by attempting the request to /search in a Java program instead. I used the OAuth token that I got when authenticating using my web app in a java program and made the request with the Authorization: OAuth <token> header set) and the request was successful.

Configuring Google Drive API and SDK

I'm attempting to install the DrEdit sample app for Salesforce onto GAE. The app runs, but saving or opening a file results in an HTTP 403 "Access Not Configured Error".
I have also attempted to use the values for API Access>Client ID for web applications. The Google Drive SDK> OAuth Client ID has also been set variously to the Drive SDK and web app Client IDs.
but, After enabling both (Api, SDK) in Api access service i am still getting same error.
Please see duplicate post about this: Google Drive HTTP 403 “Access Not Configured” error
Copy of the answer given:
Can you make sure that you register your application on the Google APIs Console and enable the Drive API and SDK for it first?
It's all described here: https://developers.google.com/drive/register
Then make sure that you use your Client ID and Client Secret in DrEdit's configuration file.

Categories

Resources