kikovalle / PLGSharepointRestAPI-java

Easy to use wrapper for the Sharepoint Rest API v1. Even if this is not a full implementation it covers most common use cases and provides examples to extending this API.
MIT License
42 stars 32 forks source link

AuthenticationException #26

Open rkumarsriv opened 3 years ago

rkumarsriv commented 3 years ago

I am trying to do "Get lists of a site" by using your code sample in README.md I am getting AuthenticationException at AuthenticationResponseParser.java:40.

Thank you for your help. -R kumar

kikovalle commented 3 years ago

Hello What kind of sharepoint instance are you trying to access to (OnPremises / Online)? Are you using valid credentials? I mean, your user and password allows you to navigate the site you are trying to query with de API? In the README.md the examples show the idea of how to use the API, but not a valid sharepoint site and credentials. You have to test it against your own instance and with your own valid user pass. If i get more information about what code is throwing the exception maybe i can provide more help

rkumarsriv commented 3 years ago

Thanks for the quick response. The sharepoint is on Azure. The credentials are valid as I am able to access it from browser. Here is the full stacktrace:

Exception in thread "main" com.panxoloto.sharepoint.rest.helper.AuthenticationException: Authentication has failed : Authentication Failure at com.panxoloto.sharepoint.rest.helper.AuthenticationResponseParser.parseAuthenticationResponse(AuthenticationResponseParser.java:40) at com.panxoloto.sharepoint.rest.helper.AuthTokenHelperOnline.getSecurityTokenUsingUserName(AuthTokenHelperOnline.java:133) at com.panxoloto.sharepoint.rest.helper.AuthTokenHelperOnline.receiveSecurityToken(AuthTokenHelperOnline.java:110) at com.panxoloto.sharepoint.rest.helper.AuthTokenHelperOnline.init(AuthTokenHelperOnline.java:182) at com.panxoloto.sharepoint.rest.PLGSharepointClientOnline.init(PLGSharepointClientOnline.java:75) at com.panxoloto.sharepoint.rest.PLGSharepointClientOnline.(PLGSharepointClientOnline.java:47)

kikovalle commented 3 years ago

In the exception i see you are using the Online Client instance. If you are not using sharepoint online and you have a On Premises instance installed on azure you should use the OnPremises instance.

rkumarsriv commented 3 years ago

PLGSharepointOnPremisesClient constructor parameters is not clear to me. If "Path part" is stored in spSitePrefix then what would spSiteUrl contain? Could you please give an example for spSiteUrl and spSitePrefix .

Thanks.

lecoibr commented 3 years ago

Has anyone experienced this error?

com.panxoloto.sharepoint.rest.helper.AuthenticationException: Could not parse authentication response : Unable to create SAAJ meta-factory: Provider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found at com.panxoloto.sharepoint.rest.helper.AuthenticationResponseParser.parseAuthenticationResponse(AuthenticationResponseParser.java:46) at com.panxoloto.sharepoint.rest.helper.AuthTokenHelperOnline.getSecurityTokenUsingUserName(AuthTokenHelperOnline.java:133) at com.panxoloto.sharepoint.rest.helper.AuthTokenHelperOnline.receiveSecurityToken(AuthTokenHelperOnline.java:110) at com.panxoloto.sharepoint.rest.helper.AuthTokenHelperOnline.init(AuthTokenHelperOnline.java:182)

[SOLUTION] for Java 11, include:

https://www.studytonight.com/post/solved-unable-to-create-saaj-metafactory-provider-saajmetafactoryimpl-not-found

kikovalle commented 3 years ago

I have to take a look and make some tests with latests java versions.