Using Okta.Auth.Sdk in MVC .net app

Hi everyone,
I am trying to use Okta.Auth.Sdk in one of my controller to get SessionID. I create request as in example but when I call client.AuthenticateAsync nothing happened, as appliction wait for response but never came up. I try this exactly example on some test console application and its work fine. Is there any problem to this sdk work fine in MVC?
This example of that function that I create

public async Task AuthenticationClientAsync()
{
try
{

        var client = new AuthenticationClient(new OktaClientConfiguration
        {
            OktaDomain = "https://dev-23*****.okta.com",
           
        });

        var authnOptions = new AuthenticateOptions()
        {
            Username = $"djordje******@****.com",
            Password = "**********",
        };
        
        var authnResponse = await client.AuthenticateAsync(authnOptions);
            return authnResponse.SessionToken;
        }
        catch (AggregateException aex)
        {
            throw;
        }
        catch (Exception aex)
        {
            throw;
        }
    }

Have you tried taking a look at this sample app? https://github.com/okta/samples-aspnet/tree/master/primary-auth

Yes , I saw it. But because of my project (what I need to do) I need to user OKTA.AUTH.SDK ( to get auth via API ) to use in my solutions to get session token, just like in example I show to you.

That sample does say it uses the Okta.Auth.SDK and it does seem to get a session token https://github.com/okta/samples-aspnet/blob/master/primary-auth/okta-aspnet-mvc-example/Controllers/AccountController.cs#L63

This example shows you how to use the Okta.Auth.Sdk library to:

  • Log in a user
  • Change a user’s password (only if the password has expired)

Tnx, Warren… I opened wrong solutions from this group :smiley: I will test this example and see where I made mistakes.