AnsweredAssumed Answered

Problem with PI Web API authentication using HTML files (i.e. no web server)

Question asked by gavin.strack Champion on Feb 23, 2016
Latest reply on Sep 21, 2017 by jturow



I have encountered a problem with trying to get authentication working.


To start with, I am developing my web app on the same machine that hosts the AF server and PI Web API.  To attempt to diagnose the problem, I am using the CORS Testing app from the training video.

When I attempt to use basic authentication, I get:

Which is similar to the error expected when a request from a domain not listed in the CorsOrigins attribute.  When I look into the request header, the Origin header is like this:

Since the request is from the same machine, I don't see how CORS is even relevant, but if the browser is getting this response, who am I to argue.


So I tried adding "null", "http://localhost", "https://localhost" to the CorsOrigins attribute but I still get this error.


In the browser, my "URL" is  "file:///C:/User/....etc....etc.../cors_app.html".  I noticed that all the PI Web API tutorials appear to be using a locally hosted webserver (i.e. URL = http://localhost:12343).  Before I go an install WAMP or figure out how to use IIS, is there something simple I can do to get this working.  My web apps work fine when I don't use authentication.