Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Configured Identity and OpenId but not working (Angular and Webapi) #5950


User avatar
0
shimi created

Already tried your answer in https://support.aspnetzero.com/QA/Questions/5935

Configured Identity and OpenId but not working

Aim is to login from login.domain.com angular project (communicates with api project http://loginapi.domain.com identityserver) after login user is redirected to another subdomain accounts.domain.com angular project (communicates with api project http://accountsapi.domain.com openid) but user can't able to access it.

identityserver configuration done for loginapi.domain.com

"IdentityServer": {
    "IsEnabled": "true",
    "Authority": "http://loginapi.domain.com/",
    "ApiName": "default-api",
    "ApiSecret": "secret",

openid configuration done for accountsapi.domain.com

"OpenId": {
      "IsEnabled": "true",
      "ClientId": "demo",
      "Authority": "http://loginapi.domain.com/",
      "LoginUrl": "http://loginapi.domain.com/api/TokenAuth/Authenticate"
    },

how can i acheive this? I am new to OpenId connect please help.


9 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @shimi

    Are both apps on login.domain.com and accounts.domain.com AspNet Zero apps ?

  • User Avatar
    0
    shimi created

    @ismcagdas

    yes both are AspNet Zero apps

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @shimi,

    What is the error you are getting ? You can check App_Data/Logs/Logs.txt file to see the error details.

  • User Avatar
    0
    shimi created

    Hi @ismcagdas

    no error is there. Are my configurations correct? when i logged in from login.domain.com and reached accounts.domain.com it again asks authentication. Please put the configurations example for both domain and is there any settings needed in angular application for both domains?

    Application 1 (webapi and angular login project) Application 2 (webapi and angular accounts project)

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @shimi

    So, what happens when you enter username & password on accounts.domain.com when you redirected from login.mydomain.com ?

    Or, are you able to see the login page on accounts.domain.com ?

  • User Avatar
    0
    shimi created

    @Hi @ismcagdas,

    There is no login for accounts.domain.com any users with out authentication must be redirected to login.domain.com. And if authenticated user can access accounts.domain.com.

    My objective is very simple user logs in from login.domain.com if authenticated he can access subdomains like accounts.domain.com and hr.domain.com etc with out asking relogin. And if user is not logged in and types accounts.domain.com he will be redirected to login.domain.com

    In MVC Application we can use cookies and can set machine key in iis for this purpose. But here the problem is UI is in angular and service is Webapi for all applications.

    Is there any setting want to be enabled in Angular login application or in Angular Accounts application?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @shimi

    As I understand you are trying to configure single sign-on for your apps but it is not supported in AspNet Zero by default. So, you need to develop it yourself.

  • User Avatar
    0
    shimi created

    Hi @ismcagdas

    Is there any other settings by which I can communicate authentication between subdomains?

  • User Avatar
    0
    ryancyq created
    Support Team

    Hi @shimi, i haven't tried it yet but you can try the approach at https://forums.asp.net/t/2137772.aspx?Identity+Server+4+and+Single+Sign+On