TokenClient Error following .Net 4.x Tutorial

I have a legacy .Net 4.5.1 Web Form App that I’m trying to build Okta into. I followed the directions in the following blog exactly: https://developer.okta.com/blog/2018/08/29/secure-webforms-with-openidconnect-okta

I’m getting several errors in the Startup.cs class. They all are around creating the TokenClient class. It wants only two parameters, but the example gives three. I have a feeling this Startup.cs class is from MVC and causing this error? I’m not sure. Here is the code:

var tokenClient = new TokenClient($"{_authority}/v1/token", _clientId, _clientSecret);

Error => ‘TokenClient’ does not contain a constructor that takes 3 arguments

The signature it calls for is TokenClient(HttpMessageInvoker, TokenClientOptions)

Can anyone help?

Hi @dicer2000

Can you please open a support case with us through an email to developers@okta.com in order to further investigate this issue?

I also get the same error by following the same blog, so I would like to know the solution as well.

I too am experiencing the same problem. Not sure what is wrong. Any response yet?

just encountered the same problem, did you find what the issue with it was?

Fixed this error by replacing IdentityModel 4.x with IdentityModel 3.9.0

1 Like