Getting The remote Server returned an error: (400) Bad Request when trying to use New-SFClient with the -Credential parameter in ShareFile PowerShell Module
I have a script that creates a new .sfps file and connects to sharefile everyday.  As of August 19th this functionality has broken.  The command I use is  $SFUserName = 'User@Company.com'        $SFPassword = Get-Content \\\\server\\\\fileshare\\\\ShareFileCreds.txt | ConvertTo-SecureString        $Credential = New-Object System.Management.Automation.PSCredential($SFUserName,$SFPassword)        [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;        New-SfClient -Name ((Join-Path $env:USERPROFILE 'Documents') + '\\\\Sharefile..sfps') -Account AccountName-Credential $Credential The password is application specific password that I created in my account that has 2 factor authentication.   I am able to connect if I remove the -Credential parameter from New-SFClient but it popups the authentication to sharefile locally which I can't have when I'm scheduling this script to run.  Again, this has worked since February when I created it orginially after enabling 2 factor authentication to my account but it all of a sudden broke as of August 19th. 

  • Confirming the solution was to reset the local sharefile account password (not the application password set in 2FA), user could still login via SSO and 2FA enforced sharefile login but no prompt around the password being expired. I updated my support case with this info.
  • Thanks for your response, still no resolution here but ill review your post and see if anything applies.
  • I have resolved my issue with authentication.  Here's the steps and background to my issue.   1. The account I'm using is an Active Directory account.   2. I believe when I originally created this app I had to sign in as a regular ShareFile account and not using the Company Employee Sign in to use the Application-Specific Password. 3. I signed in as the regular ShareFile user and changed the password. 4. Generated a new Application-Specific password. 5. Create a new encrypted password file for my script to reference for authentication with application-specific password as the password. 6. I am now able to connect using the command New-SfClient -Name ((Join-Path $env:USERPROFILE 'Documents') + '\\Sharefile..sfps') -Account AccountName-Credential $Credential .    I don't know why I was able to sign in as both company employee and a regular sharefile account though with the same user name.  It has the same 2 factor settings so that's how I can tell it's the same account.  The only other info that might be helpful was that my original password was created 6 months ago for sharefile so maybe there is a password expiration for the application specific password that isn't enforced for the regular password.  I was never asked to change my password due to it being expired.     I hope this helps others. 
  • Hello.   I had exactly the same problem, turned out two factor authentication had been turned on and this was incompatible with how I was asking for the token.  I had it turned off and it started working again.    Hope this helps someone...
  • I have a support ticket open, I'm working with technical support and we're checking a bunch of stuff right now. Will keep you posted.
  • I do have a support ticket open but no info since.  They told me to post the error here and that they don't support the SDK or APIs.  Citrix needs to do better for supporting this for ShareFile as many customers rely on that for automation of business processes.  
  • Having the same/similar issue and it started around the same time as you, I can't even auth right now. Do you have a support ticket open or any info since?
This question is closed.