2

Everyone knows that SharePoint has a web service (ASMX), called Authentication.asmx, which is a good web service for doing authentication. It has a method called Login, which takes username and password and returns a cookie, if the user is valid. This is a great web service to use. But unfortunately, Microsoft recommends not to use ASMX based web services in SharePoint 2013 (probably because of performance reasons?) and mentions that it is present only for backward compatability. I was wondering, if there is an equivalent (say, WCF) for Authentication.asmx. Please let me know, if any one has any idea.

3 Answers 3

1

This modern way to connect SharePoint resource thru the REST API thru the client_ID and Client_Secret code.

Lets say target SharePoint is BBB and source application is AAA

Then we need to follow the below steps to connect to the SharePoint BBB site:

In order to achieve this access - we need to generate a client_id and client_secret from "https://BBB.sharepoint.com" site and uses that code in "AAA" site while sending the data "BBB" site.

There is a long steps how to the generate the client_id and client_secret code.

Step 1: Register Add-In

Go to the this page of your BBB site https://.SharePoint.com/_layouts/15/appregnew.aspx

Here you will get: client id and client secret

Save this information in notepad.

Step 2: Grant Permissions to Add-In

Go to this page of your BBB site:

https://.sharepoint.com/_layouts/15/appinv.aspx

Enter the "Client ID" in the App ID field and click on Lookup button

Now enter the below permission request in XML format:

<AppPermissionRequests AllowAppOnlyPolicy="true">
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="Read" />
</AppPermissionRequests>

Step 3: Retrieve the Tenant ID

In POST man tool do a GET request for this URL(BBB site):

https:///sharepoint.com/_vti_bin/client.svc/

From the Header section you will get the realm value which is nothing but your client ID.

So finally while you are sending the client id and client secret to the AAA site(your source site from where you are uploading the document), it should be in the below format:

client_id   ClientID@TenantID
client_secret   ClientSecret

Example:

client_id: 4b4276d0-74cd-4476-b66f-e7e326e2cb93@10267809-adcb-42b6-b103-c7c8190b3fed
client_secret: nuC+ygmhpadH93TqJdte++C37SUchZVK4a5xT9XtVBU=

Now when the other system here it is application "AAA site" performing the POST call to the "SharePoint site here it is https://BBB.sharepoint.com", they need to use these two client_id and client_secret key.

Detailed explanation is here:

https://www.ktskumar.com/2017/01/access-sharepoint-online-using-postman/

Similar Thread:

Authentication methods for SharePoint REST API

0

I'm not sure if something like this exists but what I do know is this username / password authentication mechanism was improved in SP 2013 to a much more secure mechanism called oAuth. If you want to perform operations on behalf of a user instead of directly authenticating the user, you can look at oAuth as an option.

oAuth uses security tokens to authenticate SharePoint add-ins and obviates the need to authenticate using username / password. You can create an add in to leverage this.

Note: oAuth is not for authenticating users. This was mainly developed to allow add-ins to perform an action / access the resources on behalf of a user.

0

You can talk to SharePoint Artifacts normally using Add-ins. Generally, you need to consume RESTful Endpoints exposed by SharePoint and for consuming them outside of SharePoint you need a access token.

Also, if you want to access SharePoint Artifacts from outside of SharePoint (say, in a console application ), you can always use ClientContext and its property NetworkCredentials for On Premise Installation and SharePointOnlineCredentials for O365 infrastructure.

Understanding and Using the REST interface

OAuth In SharePoint

Obtaining An access Token

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.