FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login
    1. Home
    2. xan
    3. Posts
    X
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 18
    • Best 5
    • Controversial 0
    • Groups 0

    Posts made by xan

    • RE: Problems logging in user through C# API call

      @dan

      @dan said in Problems logging in user through C# API call:

      e

      The ultimate help ended up being this
      https://github.com/FusionAuth/fusionauth-netcore-client/blob/master/fusionauth-netcore-client-test/fusionauth-netcore-client-test/test/io/fusionauth/FusionAuthClientTest.cs
      which went over each functionality which was nice. Otherwise comments of functions on the API would be nice as at points it is a bit unclear. Honestly this was the only problem I have faced so far(and it was just my fault in the end), and it has been an amazing tool.

      posted in Q&A
      X
      xan
    • RE: Problems logging in user through C# API call

      Yep, I wasn't assigning the values correctly for the service. All fixed!

      posted in Q&A
      X
      xan
    • RE: Problems logging in user through C# API call

      I got it working in a separate console app, so must be something in my app.

      posted in Q&A
      X
      xan
    • RE: Problems logging in user through C# API call

      A new update. I can do a get user by email, but if I try to do user login both sync and async it throws a 404 status code. So clearly it is finding the server, maybe it just can't find the login portal?

      posted in Q&A
      X
      xan
    • RE: Problems logging in user through C# API call

      Any suggestions on how to proceed, or is this a bug I should report?

      posted in Q&A
      X
      xan
    • RE: Problems logging in user through C# API call

      Though it looks like I have two applications, a base FusionAuth and then my applications, both using the same localhost:9011. How does it seperate them out? And if I need to change that where do I do that?

      posted in Q&A
      X
      xan
    • RE: Problems logging in user through C# API call

      This is where I build the FusionAuth Client.

      public static FusionAuthClient FusionAuth;
      public static FusionAuthClient Build(IConfiguration configuration)
      {
          if (FusionAuth == null)
              FusionAuth = new FusionAuthClient(
                  apiKey:configuration.GetConnectionString(FusionAuthMgmtServerInfo.ApiKey),
                  host:configuration.GetConnectionString(FusionAuthMgmtServerInfo.FusionauthUrl),
                  tenantId:configuration.GetConnectionString(FusionAuthMgmtServerInfo.TenantId));
          return FusionAuth;
      }
      

      which just are the ""UsersManagement:ApiKey", "UserManagement:Server", "UserManagement:ClientID"

      EDIT:
      Also in the webportal admin page for the application my "Authorized redirect URLs" is "http://xxx.xxx.xxx.xxx:5000/signin-oidc"(with the xxx being the servers public static ipv4), and "LogoutURL" as "http://xxx.xxx.xxx.xxx:5000"

      If I look at the application details it shows.

      OAuth IdP login URL:	 http://localhost:9011/oauth2/authorize?client_id=[CLIENTID]&response_type=code&redirect_uri=http%3A%2F%2F[SERVERIpv4]%3A5000%2Fsignin-oidc
      Logout URL:	         http://localhost:9011/oauth2/logout?client_id=[CLIENTID]
      Introspect endpoint:	 http://localhost:9011/oauth2/introspect
      Token endpoint:	         http://localhost:9011/oauth2/token
      Userinfo endpoint:	 http://localhost:9011/oauth2/userinfo
      Device endpoint:	 http://localhost:9011/oauth2/device_authorize
      OpenID Connect Discovery:http://localhost:9011/.well-known/openid-configuration/[TENANT_ID]
      JSON Web Key (JWK) Set:	 http://localhost:9011/.well-known/jwks.json
      

      with [] being what they should be(excluded by me).

      posted in Q&A
      X
      xan
    • RE: Problems logging in user through C# API call

      @dan said in Problems logging in user through C# API call:

      _faClient

      So _faClient is DIed. The service is setup here.

      services.AddTransient<IFusionAuthAsyncClient, FusionAuthClient>(_ =>
      {
          return FusionAuthClientBuilder.Build(context.Configuration);
      });
      

      How do I check to see if the server has started? I have the firewall open on that port(in and out), and can login through the 9011 port.
      This is setup on a ec2 server, so I am using a static ip to make calls to it, and I have those specified in my User secrets, which looks like.

      {
        "UsersManagement":{
          "ClientSecret" : "XXXX",
          "ApiKey" : 	"XXXX",
          "Server" : "http://xxx.xxx.xxx.xxx:9011",
          "Authority" : "http://SAME.AS.ABOVE:9011",
          "TenantId" : "XXXX",
          "ApplicationId" : "XXXX",
          "ClientID" : "SAME AS ABOVE"  }
      }
      

      Which looking at the example project you linked they have

      "SampleApp" : { 
            "Authority" : "http://localhost:9011",
            "CookieName" : "sampleappcookie",
            "ClientId" : "4420013f-bc5e-4d5a-9f94-f4b64ad5107c"
         }
      

      Does the json object have to be the name of the project, assembly, or namespace?
      EDIT: Ah nevermind they are specifying it in the AddOpenIdConnect, where instead I am using the Client Object.

      posted in Q&A
      X
      xan
    • RE: Problems logging in user through C# API call

      I fallowed this tutorial
      https://fusionauth.io/blog/2020/05/06/securing-asp-netcore-razor-pages-app-with-oauth/
      should I see something when I do "http://localhost:5000", currently it just gets a "localhost refused to connect."?

      posted in Q&A
      X
      xan
    • Problems logging in user through C# API call

      Hi.

      I am trying to make a login for my BlazorServer app, but I am having a problem of the webbrowser throwing the bellow error.

      System.ArgumentNullException: Value cannot be null. (Parameter 'uriString')
         at System.Uri..ctor(String uriString)
         at io.fusionauth.DefaultRESTClient..ctor(String host)
         at io.fusionauth.DefaultRESTClientBuilder.build(String host)
         at io.fusionauth.FusionAuthClient.buildAnonymousClient()
         at io.fusionauth.FusionAuthClient.buildClient()
         at io.fusionauth.FusionAuthClient.LoginAsync(LoginRequest request)
         at Roots.FusionAuth.Users.FusionAuthUserManager.Login(String email, String password) in D:\Projects\GenoTech\Roots\Roots.FusionAuth\Levels\
      

      I can't find what field I am not setting, but for reference here is my login code.

      var loginRequest = new LoginRequest();
                  
      Guid appID = new Guid();
      string? stringID = FusionAuthMgmtServerInfo.ApplicationId;
      if (Guid.TryParse(stringID, out appID)) { }
      else
          _log.LogError("Couldn't convert Application Id, string to Guid.");
                  
      loginRequest.applicationId = appID;
      loginRequest.password = password;
      
      loginRequest.ipAddress = FusionAuthMgmtServerInfo.FusionauthUrl;
      
      Task<ClientResponse<LoginResponse>> loginTask;
      await (loginTask = _faClient.LoginAsync(loginRequest));
      
      var loginResponse = loginTask.Result;
      

      I was thinking it was the .ipAddress but since the library has no commenting I have been shooting in the dark most of the time with all this.

      posted in Q&A
      X
      xan
    • RE: Can't connect to web interface.

      On further inspection, it seems that elasticsearch is using alot of cpu

          PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
        17770 ubuntu    20   0 3143044 907224 181732 S 168.3  45.4   0:18.27 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.ne
      
      posted in General Discussion
      X
      xan
    • RE: Trying to install into docker, but getting permission error.

      For anyone interested I got this running by one installing docker-compose from the actual docker tutorial on how to do it, and then giving docker permission to run commands as root. There is a tutorial on how to do it on. On top of those I moved it to a server with 2gb of ram, as I noticed a few out of memory errors when it was trying to start up.
      https://docs.docker.com/engine/install/linux-postinstall/

      posted in General Discussion
      X
      xan
    • Can't connect to web interface.

      I got fusionauth running in a docker in ubuntu and have the 9011 port opened to my ip, but when I put in the servers address(and/or with the ip, and/or http/s) it times out.

      xxx.xxx.xxx.xxx took too long to respond.

      I am not sure what to do next, though I still need to setup the .env file which is my next step.

      Here is some info that might be helpful

      ~$ docker ps
      CONTAINER ID   IMAGE                                                 COMMAND                  CREATED      STATUS          PORTS                    NAMES
      77842e098721   fusionauth/fusionauth-app:latest                      "/usr/local/fusionau…"   6 days ago   Up 30 seconds   0.0.0.0:9011->9011/tcp   ubuntu_fusionauth_1
      dcbfc8978431   docker.elastic.co/elasticsearch/elasticsearch:7.8.1   "/tini -- /usr/local…"   6 days ago   Up 30 seconds   9200/tcp, 9300/tcp       ubuntu_search_1
      3e5cb9c95e25   postgres:11.9-alpine                                  "docker-entrypoint.s…"   6 days ago   Up 30 seconds   5432/tcp                 ubuntu_db_1
      
      ~$ curl -v http://fusionauth:9011
      * Could not resolve host: fusionauth
      * Closing connection 0
      curl: (6) Could not resolve host: fusionauth
      ubuntu@ip-172-31-80-105:~$ curl -v localhost:9011
      *   Trying 127.0.0.1:9011...
      * TCP_NODELAY set
      * Connected to localhost (127.0.0.1) port 9011 (#0)
      > GET / HTTP/1.1
      > Host: localhost:9011
      > User-Agent: curl/7.68.0
      > Accept: */*
      >
      * Mark bundle as not supporting multiuse
      < HTTP/1.1 302
      < Location: /login
      < Content-Length: 0
      < Date: Mon, 28 Dec 2020 16:26:30 GMT
      <
      * Connection #0 to host localhost left intact
      
      ~$ curl -v http://fusionauth:9011
      * Could not resolve host: fusionauth
      * Closing connection 0
      curl: (6) Could not resolve host: fusionauth
      
      

      It does look like elasticsearch keeps restarting.

      posted in General Discussion docker user management
      X
      xan
    • RE: Trying to install into docker, but getting permission error.

      @mgetka Thanks for the hints. I am fairly new to docker, but know a good amount of linux so worked through it. Do you know a good tutorial for installing it the way you described? Or how to add snap permissions?

      Also not sure what the docker-compose tool is, would that be related to me installing with the docker repo method?

      posted in General Discussion
      X
      xan
    • RE: Trying to install into docker, but getting permission error.

      Here is the full log if it helps.

      % Total % Received % Xferd Average Speed Time Time Time Current
      Dload Upload Total Spent Left Speed
      100 1585 100 1585 0 0 68913 0 --:--:-- --:--:-- --:--:-- 68913
      % Total % Received % Xferd Average Speed Time Time Time Current
      Dload Upload Total Spent Left Speed
      100 418 100 418 0 0 3834 0 --:--:-- --:--:-- --:--:-- 3834
      Traceback (most recent call last):
      File "/snap/docker/471/bin/docker-compose", line 11, in <module>
      load_entry_point('docker-compose==1.25.5', 'console_scripts', 'docker-compose')()
      File "/snap/docker/471/lib/python3.5/site-packages/compose/cli/main.py", line 72, in main
      command()
      File "/snap/docker/471/lib/python3.5/site-packages/compose/cli/main.py", line 125, in perform_command
      project = project_from_options('.', options)
      File "/snap/docker/471/lib/python3.5/site-packages/compose/cli/command.py", line 47, in project_from_options
      environment = Environment.from_env_file(override_dir or project_dir, environment_file)
      File "/snap/docker/471/lib/python3.5/site-packages/compose/config/environment.py", line 77, in from_env_file
      instance = _initialize()
      File "/snap/docker/471/lib/python3.5/site-packages/compose/config/environment.py", line 72, in _initialize
      return cls(env_vars_from_file(env_file_path))
      File "/snap/docker/471/lib/python3.5/site-packages/compose/config/environment.py", line 43, in env_vars_from_file
      with contextlib.closing(codecs.open(filename, 'r', 'utf-8-sig')) as fileobj:
      File "/snap/docker/471/usr/lib/python3.5/codecs.py", line 895, in open
      file = builtins.open(filename, mode, buffering)
      PermissionError: [Errno 13] Permission denied: './.env'

      posted in General Discussion
      X
      xan
    • Trying to install into docker, but getting permission error.

      Hi all, I tried to use the docker install command but am getting the fallowing message when I try to run it.

      PermissionError: [Errno 13] Permission denied: './.env'

      I tried running with sudo, and also do 'sudo -i'

      docker is installed as I fallowed the tutorials here
      (sorry if outside links aren't allowed, I couldn't find rules to this forum) https://docs.docker.com/engine/install/ubuntu/

      posted in General Discussion
      X
      xan