Contents
The hosting browser is authenticating against the url and any fututre request within the authenticated “session” is working. In your scenario you will try to access the REST api of sharepoint and the server is sending back a 401 HTTP status code so the browser lets the user enter the credentials.
How to setup an authentication request in JavaScript?
In this case, authentication request will be setup in the following way: Below are my Javascript and HTML code. var userName = “clientID”; var passWord = “secretKey”; function authenticateUser (user, password) { var token = user + “:” + password; // Should i be encoding this value????? does it matter???
How can I suppress the browser’s authentication?
The web server returns a 401 status code and includes one or more WWW-Authenticate headers listing the supported authentication types. The browser detects that the response to my call on the XMLHttpRequest object is a 401 and the response includes WWW-Authenticate headers.
How does user authentication work in SharePoint Server?
User authentication in SharePoint Server. User authentication is the validation of a user’s identity against an authentication provider, which is a directory or database that contains the user’s credentials and can verify that the user submitted them correctly. User authentication occurs when a user attempts to access a SharePoint resource.
Note that if the SharePoint app does not require a SharePoint secured resource to render the page for the user, app authentication is not needed. For example, a SharePoint app that provides weather forecast information and only has to access a weather information server on the Internet does not have to use app authentication.
Try a picture from the sharepoint url. The “browser” normaly trieds to authenticate and will prompt the user to authenticate (depends on the platform). maybe you can change a setting of the “browser” that autnetication is allowed. After that authentication request you should be able top authenticate to the REST service.
How to add JavaScript to a SharePoint script?
If there’sn’t, but there’s an App.js file, right-click App.js and rename it Add-in.js. If there’sn’t an Add-in.js or App.js, create one with these steps: Right-click the Scripts node and select Add > New Item > Web. Select JavaScript File and name it Add-in.js.
Can a SharePoint add in have server side code?
Even though SharePoint-hosted SharePoint Add-ins cannot have server-side code, you can still have business logic and runtime interaction with SharePoint components in a SharePoint-hosted SharePoint Add-in by using JavaScript and the SharePoint JavaScript client object model library.