sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

bad sign in error

Open shivdk7 opened this issue 7 years ago • 12 comments

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

bad sign error should not come when trying to access modern sharepoint sites

Observed Behavior

api are hosted on azure platform and when we are trying to access sharepoit api using user credentials we are facing the below.

The partner returned a bad sign-in name or password error. For more information, see Federation Error-handling Scenarios.

Microsoft.SharePoint.Client.IdcrlException: The partner returned a bad sign-in name or password error. For more information, see Federation Error-handling Scenarios. at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.DoPost(String url, String contentType, String body, Func2 webExceptionHandler) at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetPartnerTicketFromAdfs(String adfsUrl, String username, String password) at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken(String username, String password, String serviceTarget, String servicePolicy) at Microsoft.SharePoint.Client.Idcrl.SharePointOnlineAuthenticationProvider.GetAuthenticationCookie(Uri url, String username, SecureString password, Boolean alwaysThrowOnFailure, EventHandler1 executingWebRequest) at Microsoft.SharePoint.Client.SharePointOnlineCredentials.GetAuthenticationCookie(Uri url, Boolean refresh, Boolean alwaysThrowOnFailure) at Microsoft.SharePoint.Client.ClientRuntimeContext.SetupRequestCredential(ClientRuntimeContext context, HttpWebRequest request) at Microsoft.SharePoint.Client.SPWebRequestExecutor.GetRequestStream() at Microsoft.SharePoint.Client.ClientContext.GetWebRequestExecutor() at Microsoft.SharePoint.Client.ClientContext.d__b.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.SharePoint.Client.ClientContext.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.SharePoint.Client.ClientContext.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.SharePoint.Client.ClientContextExtensions.d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay, String userAgent) at IPKitProvisioning.Func_ApplyIPKitPostProvisioning.SaveModernIPKitProvisioning(ModernIPKitProvisioning modernIPKitProvisioning, ILogger log)

Thanks for your contribution! Sharing is caring.

shivdk7 avatar Jul 30 '19 15:07 shivdk7

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Jul 30 '19 15:07 msft-github-bot

Can you provide a bit more information about your environment? Are you positive the credentials provided are accurate? Are you using MFA or Modern Auth?

bcameron1231 avatar Jul 30 '19 16:07 bcameron1231

@andrewconnell @bcameron1231

Environment - SharepointOnline Source -> called in Eventtriggered Azure function (we use post provisioning agent) Yes, We are positive about the credentials used. We use service account for which MFA is disabled to get the client context.

Note: No exception occurs while debugging Azure function locally. Exception happens only in the published code on Azure.

shivdk7 avatar Jul 31 '19 05:07 shivdk7

Thank you.

To confirm, when you say debugging locally you mean running the Azure Function in with Azure Function Tools? When you publish the Azure Function, do you make any changes to code or credentials?

bcameron1231 avatar Aug 02 '19 11:08 bcameron1231

Yes, locally with Azure function tools for debugging. And we don't change any code or credentials

shivdk7 avatar Aug 02 '19 13:08 shivdk7

Hi! actually we are stuck up at this point ,if any further inputs that would be help @bcameron1231.Thankyou

shivdk7 avatar Aug 07 '19 10:08 shivdk7

Hi @shivdk7 , I've been trying to think what the problem could be. The only time I've actually seen this issue with this architecture, is when Azure PowerShell caches credentials from previous runs. That is, I tested against a different tenant, changed my credentials and new Office 365 tenant, and it kept using the old credentials from previous runs.

What baffles me is that it works in your local Azure Function run time but not once it's published. Have you been able to log the values to make sure they are what you are expecting when the Azure Function runs?

bcameron1231 avatar Aug 07 '19 12:08 bcameron1231

Hi @bcameron1231 , we were able to log the values and it is the same what we expect when Azure functions runs.

shivdk7 avatar Aug 08 '19 06:08 shivdk7

By chance are you able to send the sln? You can strip out any proprietary information. I am unable to repro connections from my side of things.

bcameron1231 avatar Aug 08 '19 15:08 bcameron1231

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

msft-github-bot avatar Aug 16 '19 20:08 msft-github-bot

Closing issue due no response from original author. If this issue is still occurring, please open a new issue with additional details. Notice that if you have included another related issue as additional comment on this, please open that also as separate issue, so that we can track it independently.

msft-github-bot avatar Aug 23 '19 21:08 msft-github-bot

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 24 '20 00:01 msft-github-bot