Handle tenant in provider-hosted app for SharePoint

Apr 23, 2014 at 9:46 PM
Hello,

What proper way to handle tenant in provider-hosted app for SharePoint? Can I use for this ClientContext.Web.Url (https://<tenant_name>.sharepoint.com) or SharePointContextToken.TargetPrincipalName ?

Thanks.
Coordinator
Apr 25, 2014 at 7:07 AM
Hi,
you should be using GetRealmFromTargetUrl method from TokenHelper to get the uniquely identifying tenant ID. URL option is not good in long run, if we will introduce possibility to change the tenant URL in future and this is known request from customers, so it could be something which we will enable in future.
Marked as answer by vesaj on 5/19/2014 at 10:42 AM