Basic Authentication to SharePoint 2019 through REST APIs

Ryan Josefsberg 0 Reputation points
2023-08-14T22:57:39.36+00:00

Hello!

We have On-premise SharePoint 2019 set up with OOTB settings and NTLM authentication. We have a user who is in the groups: Administrators, WSS_RESTRICTED_WPG_V4, and WSS_ADMIN_WPG as well as a content farm admin.

We are trying to authenticate this user via an on premise java application using Basic Authentication via REST (non-negotiable requirement). After logging into SharePoint through the browser, it seems that our site is also not contacting the REST APIs, as we can see spoapp.js failing to complete calls.

Here's what we've tried:

Basic GET call in the browser while logged in

NTCredentials in Java

NTLM Authentication in Postman

All of which give us the following:

"The Web application at <oursp>/sites/oursite/_api/web/lists could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application."

I understand what the url mappings for in concept, but Im not sure that's "The fix", or how to map for the entirety of the instance if that was it. Unfortunately, while I'm pretty well versed in using the API online and Graph, my server admin skills might not be up to snuff. Any advice would be appreciated.

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,422 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,558 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. ChengFeng - MSFT 5,045 Reputation points Microsoft External Staff
    2023-08-15T07:47:53.2133333+00:00

    Hi @Ryan Josefsberg

    I’m sorry to hear that you are having trouble with SharePoint 2019 REST API authentication.

    To help you better, can you provide some information about your scenario? (Pay attention to the protection of personal privacy)

    I have searched the web for some possible solutions and here is what I found:

    Please enable Basic Authentication on your SharePoint web application in the Central Administration site.

    Configure your web.config file to allow Basic Authentication and disable anonymous access.

    Correct URL Format: Ensure that the URL you're using for making REST API calls is correctly formatted. Double-check that the site URL and the endpoint path are accurate.

    URL Mappings: While SharePoint does have managed paths and URL mappings, you typically don't need to manually configure these mappings for the REST API to work. However, if you suspect URL mapping issues, it's a good idea to verify that the URL you are using is correct. SharePoint's REST API URL structure generally follows this pattern: https://<yourserver>/<sitecollection>/<site>/_api/web.

    Headers and Authorization: Make sure that you're setting the appropriate headers in your Java application's HTTP requests. For Basic Authentication, you need to include an Authorization header with a base64-encoded combination of the username and password (e.g., Authorization: Basic <base64_encoded_username_password>).

    NTLM Authentication: Since you're using NTLM authentication, you should ensure that your Java application handles NTLM authentication correctly. NTLM can be quite complex to implement manually, so you might want to consider using libraries or tools that support NTLM authentication out of the box.

    Here is a link for your reference:

    https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards

    Cheng Feng


  2. Ryan Josefsberg 0 Reputation points
    2023-08-15T13:31:49.7466667+00:00

    The answer was to enable basic authentication in the IIS settings, for anyone else who runs into this one.

    0 comments No comments

  3. ChengFeng - MSFT 5,045 Reputation points Microsoft External Staff
    2023-08-21T07:07:07.49+00:00

    Hi @ Ryan Josefsberg

    I'm glad to hear you solve the problem ,if you have any issue about SharePoint, you are welcome to raise a ticket in this forum.

    By the way, since the Microsoft Q&A community has [a policy]1 that "The question author cannot accept their own answer. They can only accept answers by others." and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:

    [Basic Authentication to SharePoint 2019 through REST APIs]

    Issue Symptom:

    We are trying to authenticate this user via an on premise java application using Basic Authentication via REST (non-negotiable requirement). After logging into SharePoint through the browser, it seems that our site is also not contacting the REST APIs, as we can see spoapp.js failing to complete calls.

    Solution:

    The answer was to enable basic authentication in the IIS settings, for anyone else who runs into this one.

    You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.