1

I am implementing OAuth outside sharepoint in a java client to read a Sharepoint List using REST endpoints. While I have implemented everthing using Access token, I need to know what needs to be done when earlier Refresh token expires? How can I get a new refresh token? Because, when we request a access token using refresh token, it does not send new one....

Also since refresh token is valid for 6 months, how can I test this scenario to make sure that flow works.

1

Refresh token means user has given consent for auth for a particular period (6 months for SharePoint). When they expire, user has to grant that consent again to your App, so you need to redirect the user to your app page. You can read more on "Get a new context token" in https://msdn.microsoft.com/en-us/library/office/dn762763.aspx

However, if your Java client is a back-end application that operates without user interaction then you cannot redirect the user to app page. For this scenario, instead of refresh token you can use App Only Access permissions (of course user has to approve the app only access while installing the app).

With app only access, you can get a token and create clientContext without refresh token. Here you will be interacting with SharePoint just as an App (and not as an App + User). Take a look at GetAppOnlyAccessToken method in TokenHelper.cs (sorry, I have not worked with Java based SharePoint apps).

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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