Base solution for your next web application
Open Closed

Identity Server for SSO #5653


User avatar
0
lhightower created

I'm having an issue while trying to run both the consoleapiclient and the public site.

The clientapi app runs and I get a token, but the subsequent call to

await GetUsersListAsync(accessToken);

returns an "unauthorized"

The appsettings.json file on the server has this definition for the client:

{
            "ClientId": "client",
            "AllowedGrantTypes": [
                "password"
            ],
            "ClientSecrets": [
                {
                    "Value": "def2edf7-5d42-4edc-a84a-30136c340e13"
                }
            ],
            "AllowedScopes": [
                "default-api",
				"openid"
            ]
        },
       

Any help on what I might be doing wrong?


11 Answer(s)
  • User Avatar
    0
    alirizaadiyahsi created

    Did you change anything in ConsoleApiClient? For example username or password?

  • User Avatar
    1
    muhittincelik created

    https://support.aspnetzero.com/QA/Questions/5611#answer-453ccd2d-5dd4-f7e1-ce72-39e91e2251e0

  • User Avatar
    0
    lhightower created

    I followed the instructions in the support ticket above. I downloaded the latest version of my app and now I'm running into an error earlier in the process:

    Address is a required field. Is there something in version 6.0 that could be causing the issue?

  • User Avatar
    0
    alper created
    Support Team

    enable Identity server in appsettings.json

  • User Avatar
    0
    lhightower created

    it's enabled... unless I need to do something else:

  • User Avatar
    0
    ismcagdas created
    Support Team

    @lhightower have you fixed the problem ? The app might still be reading from the appsettings.json in the bin folder.

  • User Avatar
    0
    alper created
    Support Team

    or if you changed the environment variable, it can read from appsettings.production.json as well.

  • User Avatar
    0
    scharada created

    Actually this issue existed also in 5.6.2 , i have the same problem. in fact hybrid authentication mode also does not work...

  • User Avatar
    0
    lhightower created

    @scharada did you ever figure out what the issue was? This is a showstopper for me b/c this is the only reason I purchased AspNetZero.

  • User Avatar
    0
    alirizaadiyahsi created

    Hi @lhightower, this problem should be fixed in v6.0. If you use older version than v6.0, then you can apply THIS change to fix problem.

  • User Avatar
    0
    alper created
    Support Team

    actually you have a guide in your current code-base (if you're using core version). The Xamarin application is connecting to the backbone and consuming application services. So take look at this code which logins with a user and then makes all the actions which needs authentication.

    And there's AbpApiClient class which sends POST/GET/PUT/DELETE actions to the AspNet Zero application services. Take your time and see those classes. It works just as you want.