+ Start a Discussion
Wonder WomanWonder Woman 

How to authenticate Share Point from an Apex trigger

Hi,

 

I am trying to do an integration with Share Point from an apex trigger.

 

I have a Web Service on Share Point I can call with a callout from the trigger using HTTPRequest.

 

The main issue is, how do I authenticate the Share Point user in order to make this call?

 

Does anyone have experience with authenticating a user on another domain from SF?

 

Thanks,

 

WW 

chinnuchinnu

What kind of authentication mechanism you have on share point side ? Like Basic Auth, OAuth etc ..

 

If its simple Basic Auth, you can set the username and password in the header and call the request.

Wonder WomanWonder Woman

It is the basic Auth.

 

This is the code I've been using:

 

=============

 

Http http = new Http();

HttpRequest loginRequest = new HttpRequest();

loginRequest.setEndpoint(' Share Point URL');
loginRequest.setMethod('GET');

String username = 'domain' + '\\' + 'user';
String password = 'password';

Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' +
EncodingUtil.base64Encode(headerValue);
loginRequest.setHeader('Authorization', authorizationHeader);

HttpResponse res1 = http.send(loginRequest);

 

=========

 

Can you please see if I did something wrong?