I am facing this issue while trying to configure K2 for Sharepoint App.
When I run the registrations wizard, it successfully configures the first two steps - OAuth Tokens and Claims. In 'Administrative OAuth Tokens' it redirects to azure and prompts for trust to the app. When I click on trust, it redirects to [server name]/Identity/token/Home/Error with 'User Not Authorized'. Also, when I expand the exception details tab, there is no information available there.
I captured the process from Registration wizard to the error page in fiddler and tried to decipher the flow of requests. Here is what I interpreted regarding the flow of requests
- When the user clicks on registration wizard, it first prompts for the k2 designer url.
- First the OAuth Tokens gets created then the Claims token gets created
- Then there is a request from the smart form to the k2 server on [server]/Identity/authorize/oauth/2 with resourceID etc.as parameters.
- I guess, on this, the k2 server queries the databasefor an existing token, and in my case doesnt find it.
- The callback function gets a 401 not found error.
- This leads to the callback process initiatiates a prompt for Azure Level trust for the app from the user.
- When I click on 'trust' in the app, the k2 server is hit with something like ["admin-authorization" = true] as parameter.
I assume at this level the the refresh token gets stored in k2 server.
Then call-back function sends a request to [server]/Identity/token/oauth/2 (where I guess, it queries for the token that has just been created)
Then it redirected to [server]/Identity/Home/Error - with message that authorization not successful.
Earlier I had deleted a saved token at - [server]/Runtime/Runtime/Manage+OAuth+Tokens. It has not been regenerated yet, I think it will be generated once the registration wizard is able to run properly.
In the following chart, I think the issue pops up between the steps 13-18.
How do I resolve this Issue? Any Pointers regarding this would be great help.