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?
Related
Hello fellow developers and data scientists. I have a question about a problem with accessing the API deployed on the google app engine from the javascript app deployed on Heroku.
When I access my API link on google chrome, it works properly. However, when I use my javascript app deployed on Heroku to call my API link, it sometimes does not work and return me the network error. CORS error
I have followed the instruction on "https://cloud.google.com/appengine/docs/standard/python3/config/appref" to enable the CORS access on my app API in the app.ymal file on google app engine as the following
runtime: python37instance_class: F4_1Ghandlers:
- url: /images
static_dir: static/images
http_headers:
Access-Control-Allow-Origin: ‘*’
Similarly, I have also enabled the CORS access on my javascript app (React) deployed on Heroku as shown in the picture attached. CORS enabled on Heroku However, the problem still persists. I am not sure if it has to do with the way we set up our code or the google app engine server itself. If there is anything I could do besides what I have done I would love to hear that as well. Thanks a lot!
The instructions listed on the google cloud documents (CORS Support) apply only to static assets (such as images). However if you want to call your API (which consists of dynamic pages like Python scripts) you have to do the configuration on the Python side, by sending the appropriate headers from your scripts. Here's an example on how to do it by using a Flask extension called Flask-CORS:
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
#app.route("/api/v1/users")
def list_users():
return "user example"
The way to do it on your own script really depends on your implementation.
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.
First I would like to describe how our system looks like. We have two servers.
The first one is on Google App Engine and has some logic that provides access to database for Android application and also has some servlets written for external communication (more about that later).
The second one is on Google Cloud Engine. Application is written in Meteor (to simplify, it's just Node.js). We would like to communicate between those servers (GCE -> GAE). We have rest API on this servlet endpoint under address e.g. https://appname.appspot.com/admin/upload. When I'm making request without authentication, everything work fine:
HTTP.get(getURL, {}, getCallback);
However, I have no idea how to do it using oAuth2 authentication. When I go to the address https://appname.appspot.com/admin/upload from the browser, it redirects me to Google authentication and everything works fine (I have my account added in the Google Console). But how to send http request from the Node.js server using oAuth2 authentication?
To give you more details, here is servlet configuration:
<security-constraint>
<display-name>SecurityConstraint</display-name>
<web-resource-collection>
<web-resource-name>WRCollection</web-resource-name>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
and
<servlet-mapping>
<servlet-name>UploadRequestServlet</servlet-name>
<url-pattern>/admin/upload</url-pattern>
</servlet-mapping>
I know that I have to set server to server communication but how to accomplish this using Node.js? Could anyone help? I don't know where to start...
If anyone have problem with server-to-server communication (Meteor.js server to Google server) using OAuth 2.0 checkout library I've created https://github.com/jagi/meteor-google-oauth-jwt. It makes calling Google REST API from Meteor.js server much simpler.
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.
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.