Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration error with valid configuration #12

Closed
nbarbettini opened this issue Jan 25, 2019 · 6 comments
Closed

Configuration error with valid configuration #12

nbarbettini opened this issue Jan 25, 2019 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@nbarbettini
Copy link
Contributor

This code throws an exception:

using Okta.Auth.Sdk;
using Okta.Sdk.Abstractions.Configuration;

namespace DotnetAuthSdkTester
{
    class Program
    {
        static void Main(string[] args)
        {
            var client = new AuthenticationClient(new OktaClientConfiguration
            {
                OktaDomain = "https://dotnet.oktapreview.com",
                Token = "abc123notreal"
            });
        }
    }
}

The exception is:

System.ArgumentNullException: 'Your Okta URL is missing. You can copy your domain from the Okta Developer Console. Follow these instructions to find it: https://bit.ly/finding-okta-domain
Parameter name: OktaDomain'

@nbarbettini nbarbettini added the bug Something isn't working label Jan 25, 2019
@gitvinit
Copy link
Contributor

gitvinit commented Feb 6, 2019

@nbarbettini @laura-rodriguez it seems the parameters aren't being passed to the base class BaseOktaClient constructor from AuthenticationClient constructor which is causing this exception. I can submit a PR if this hasn't been fixed yet

@laura-rodriguez
Copy link
Collaborator

laura-rodriguez commented Feb 6, 2019

Hi @gitvinit ,
I have been working with the Okta.Auth.Sdk by creating a new ASP.NET 4.x example and I was not able to reproduce this issue.

Can you please try with the sample and tell me if you are still facing this issue?
The project is in the primary-auth folder in the following branch: https://github.com/okta/samples-aspnet/tree/add-authn-sample
(waiting for approval to be merged).

You can replace the placeholders with your Okta configuration in the Web.Config or plug your values directly in the following code in the UnityConfig.cs file:

container.RegisterType<IAuthenticationClient>(new InjectionFactory(o => new AuthenticationClient(
                new OktaClientConfiguration()
                {
                    OktaDomain = ConfigurationManager.AppSettings["okta:OktaDomain"],
                    Token = ConfigurationManager.AppSettings["okta:Token"],
                })));

@gitvinit
Copy link
Contributor

gitvinit commented Feb 6, 2019

Hi @laura-rodriguez the sample works fine. Ill tell you the steps I followed so you can reproduce the issue.
I just created a simple console app program and referenced the auth sdk and used the code nbarbettini used above and it throws the validation exception.
I am working on the auth-sdk from the master branch.

The problem I see is the code nate is using will call the following constructor in AuthenticationClient
public AuthenticationClient(OktaClientConfiguration apiClientConfiguration = null, ILogger logger = null) { }
which inturn calls the constructor
public BaseOktaClient(OktaClientConfiguration apiClientConfiguration = null, ILogger logger = null)
however the apiClientConfiguration parameter is not passed to the base constructor which defaults to null and throws an exception at OktaClientConfigurationValidator.Validate(Configuration) in the base class constructor.

Please correct me if I am missing anything.

@laura-rodriguez
Copy link
Collaborator

laura-rodriguez commented Feb 7, 2019

Hi @gitvinit,
You are right, thanks for providing the details of what's going on here 💯

If you are still up you can submit a PR. You will have to sign our contributor license agreement (https://developer.okta.com/cla/). All contributions are welcome 😄
Otherwise, I will be able to fix this these days, I'd say by the end of the next week just to be safe.

Thanks!

@gitvinit
Copy link
Contributor

Ill be glad to submit a PR ill sign and submit the CLA as well.

laura-rodriguez added a commit that referenced this issue Feb 26, 2019
* Fixes #12 
* Upgrades TLS version when running on .net framework < 4.7
@toro705
Copy link

toro705 commented Sep 25, 2019

any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants