This can be determined by Context Token as follows
protected void Page_Load(object sender, EventArgs e) { Uri hostWeb = new Uri(Request.QueryString["SPHostUrl"]); string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request); if (string.IsNullOrEmpty(contextTokenString)) { // if On-Prem using (var clientContext = TokenHelper.GetS2SClientContextWithWindowsIdentity( hostWeb, Request.LogonUserIdentity)) { . . . } } else { // if Office365 using (var clientContext = TokenHelper.GetClientContextWithContextToken( hostWeb.ToString(), contextTokenString, Request.Url.Authority)) { . . . } } . . . }
Read further to understand hybrid authentication
Thank you Tsuyoshi Matsuzaki
No comments:
Post a Comment