Jump to content
Welcome to our new Citrix community!
  • 0

Get-XDAuthentication failing behind Corp Proxy


Roonster

Question

Trying to use CitrixPoshSdk behind a corp proxy to access Citrix Cloud but getting the following error once I type in my MFA code hence do not get the Citrix Account selection dropdown.

Get-XDAuthentication : AuthenticationFailed
At line:1 char:1
+ Get-XDAuthentication
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Get-XDAuthentication:String) [Get-XDAuthentication], InvalidOperationException
    + FullyQualifiedErrorId : Citrix.Sdk.Proxy.AuthenticationFailed,Citrix.Sdk.Proxy.GetXDAuthenticationCommand

 

I've tried all methods of authentication with Get-XdAuthentication (interactive, bearertoken, profile etc.) but they result in pretty much the same.

 

I have set my Powershell session to use the corp proxy, can use Invoke-WebRequest to get a valid bearer token and even call Citrix Cloud & CVADS RESTApi's without any issues.

 

Its just CitrixPoshSdk that fails.

 

Here's the -verbose output which seems to complain trying to get the bearer token

VERBOSE: __AllParameterSets
VERBOSE: Get-XDAuthentication: Enter
VERBOSE: Get-XDAuthentication: Using config environment: com
VERBOSE: Get-XDAuthentication: GetBearerToken: transactionId: b24cc3fc-fe85-4159-a589-d2dc17d00248
VERBOSE: Get-XDAuthentication: GetBearerToken: ERROR: System.TypeInitializationException: The type initializer for
'Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient' threw an exception. ---> System.MissingMethodException: Method not found: 'Void
System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.set_SerializerSettings(Newtonsoft.Json.JsonSerializerSettings)'.
   at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient..cctor()
   --- End of inner exception stack trace ---
   at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient..ctor(String serviceUri, ConnectionSettings connectionSettings, RequestSettings settings,
HttpMessageHandler handler, Boolean disposeHandler)
   at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient..ctor(String serviceUri, HttpMessageHandler handler, Boolean disposeHandler)
   at Citrix.Sdk.Proxy.Cmdlets.GetXDAuthenticationCmdlet.<GetCwsTokenAsync>d__52.MoveNext() in
C:\tc\work\d036ba44a9f2b2c5\Cloud\PoshSdkProxySnapIn\Components\Snapin\Cmdlets\GetXDAuthentication.cs:line 660
VERBOSE: Get-XDAuthentication: GetBearerToken: transactionId: 2cf58e81-1724-4592-9bec-c6d372513015
VERBOSE: Get-XDAuthentication: GetBearerToken: ERROR: System.TypeInitializationException: The type initializer for
'Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient' threw an exception. ---> System.MissingMethodException: Method not found: 'Void
System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.set_SerializerSettings(Newtonsoft.Json.JsonSerializerSettings)'.
   at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient..cctor()
   --- End of inner exception stack trace ---
   at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient..ctor(String serviceUri, ConnectionSettings connectionSettings, RequestSettings settings,
HttpMessageHandler handler, Boolean disposeHandler)
   at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient..ctor(String serviceUri, HttpMessageHandler handler, Boolean disposeHandler)
   at Citrix.Sdk.Proxy.Cmdlets.GetXDAuthenticationCmdlet.<GetCwsTokenAsync>d__52.MoveNext() in
C:\tc\work\d036ba44a9f2b2c5\Cloud\PoshSdkProxySnapIn\Components\Snapin\Cmdlets\GetXDAuthentication.cs:line 660
VERBOSE: Get-XDAuthentication: GetBearerToken: transactionId: 71b34aec-3c81-4a9c-8ba8-8e11bf73a5fd
VERBOSE: Get-XDAuthentication: GetBearerToken: ERROR: System.TypeInitializationException: The type initializer for
'Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient' threw an exception. ---> System.MissingMethodException: Method not found: 'Void
System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.set_SerializerSettings(Newtonsoft.Json.JsonSerializerSettings)'.
   at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient..cctor()
   --- End of inner exception stack trace ---
   at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient..ctor(String serviceUri, ConnectionSettings connectionSettings, RequestSettings settings,
HttpMessageHandler handler, Boolean disposeHandler)
   at Citrix.CloudServices.ServiceRuntime.ApiClient.ServiceClient..ctor(String serviceUri, HttpMessageHandler handler, Boolean disposeHandler)
   at Citrix.Sdk.Proxy.Cmdlets.GetXDAuthenticationCmdlet.<GetCwsTokenAsync>d__52.MoveNext() in
C:\tc\work\d036ba44a9f2b2c5\Cloud\PoshSdkProxySnapIn\Components\Snapin\Cmdlets\GetXDAuthentication.cs:line 660
VERBOSE: Get-XDAuthentication: unable to get BearerToken
VERBOSE: Get-XDAuthentication: Exit

 

Any ideas ?

Link to comment

1 answer to this question

Recommended Posts

  • 0

It looks like the root cause is:

System.MissingMethodException: Method not found: 'Void 
System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.set_SerializerSettings(Newtonsoft.Json.JsonSerializerSettings)'

Googling around a little, the problem appears to be caused by an incompatible version of the Newtonsoft Json.NET library.

 

Hopefully this helps you pin down the error. Unfortunately, I'm not a .NET or PowerShell expert, so I'm not sure where to point you to resolve this...

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...