0

I'm building a Java application to extract files from Sharepoint using Sharepoint's REST api. First I need to authenticate, our organisation uses OKTA to obtain a token.

The example code I'm using is:

CredentialsProvider credsProvider = new BasicCredentialsProvider();
     credsProvider.setCredentials(AuthScope.ANY,
        new NTCredentials(user, pwd, "", ""));

HttpHost target = new HttpHost("organisation.sharepoint.com", 80, "http");

     HttpClientContext context = HttpClientContext.create();
     context.setCredentialsProvider(credsProvider);

     // The authentication is NTLM.
     // To trigger it, we send a minimal http request
     HttpHead request1 = new HttpHead("/");
     CloseableHttpResponse response1 = null;
     try {
       response1 = httpclient.execute(target, request1, context);
       EntityUtils.consume(response1.getEntity());
       System.out.println("1 : " + response1.getStatusLine().getStatusCode());

I need to modify the NTLM code to use Okta instead to make the call to Sharepoint with context set.

Any help appreciated!

  • I achieved this. See this post: http://stackoverflow.com/questions/37140940/authenticate-to-sharepoint-through-okta-from-back-end-service – Hritcu Andrei Feb 03 '17 at 14:44

1 Answers1

0

Unfortunately, this is not achievable at the moment. This feature has been requested and will be reviewed by engineering. However, it is not actively being worked on as of right now.