2

We have an OnPremise Environment for SharePoint 2013. where we have created SharePoint hosted app which calls "http://<appweburl>/_api/SP.UserProfiles.PeopleManager/GetMyProperties" to get current user's data but this gives me 401 unauthorized error. Notes:

  1. I had given read permission to user profile and full control to sitecollection in appmanifest. If I run this app on Office 365 developer site it works fine, but on premise environment it give 401 error.
  2. On premise environment when I deploy this app 3 times it prompt for credential and finally gives the following error

Message from webpage

{"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}

Any help will be appreciated.

2
  • Does your Web Application is configured to use Claims-Based Application?
    – yannisgu
    May 1, 2014 at 8:31
  • yes, it uses claim based authentication
    – Azam Khan
    May 1, 2014 at 9:11

1 Answer 1

1

Office 365 and on-premises farms use different authentication mechanisms for provider-hosted apps. It appears that you haven't properly configured the trust relationship for your app in the on-premises farm. Here are a couple resources that should help you understand the different authentication mechanisms and perform the required configuration.

Deep dive: SharePoint and Office App Security Model (OAuth & S2S)

How to: Create high-trust apps for SharePoint 2013

3
  • Thanks for reply. Ours is SharePoint Hosted App not Provider Hosted App. To make it simple i am deploying my SharePoint hosted app from Visual Studio and it is being trusted properly but after that when it redirects to the default page there i am getting the error. Does it can have any issue with AppDomain. from browser if request "http://<sitecollection>/_api/SP.UserProfiles.PeopleManager/GetMyProperties" i am getting the data but from app url "http://<app-url>/_api/SP.UserProfiles.PeopleManager/GetMyProperties" it gives the issue
    – Azam Khan
    May 1, 2014 at 9:23
  • Hmmm... that seems odd. The only thing I can think of is that your on-premises farm is not properly configured for Apps. Do you have other Apps running there? May 1, 2014 at 11:44
  • Yep Rob, I have Provider Hosted hosted with self signed certificate and its running fine without any error. Dont know what to do ?. still struggling.
    – Azam Khan
    May 5, 2014 at 5:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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