Starts in:
1 DAY
12 HRS
57 MIN
32 SEC
Starts in:
1 D
12 H
57 M
32 S
Open Closed

Angular environment config changes #1476


User avatar
0
bqabani created

Environment: Abp Commerical Version 4.2.1 Project Type: MVC + Angular Identity server and host are merge in one host project.

The problem: We need to make configuration of environment changable after the front end was published without the need to rebuild when we change the configuration.

We tried the solution here https://support.abp.io/QA/Questions/322/Angular-environment-config-changes So we added the remoteEnv section in the environment.ts and environment.prod.ts and we changed the json file to be

import { Environment } from '@abp/ng.core';

export const environment = { production: true, remoteEnv: { url: '/assets/appsettings.prod.json', method: 'GET', headers: {} }, } as Environment;

and we added /assets/appsettings.prod.json :

{

"application": {
	"baseUrl" : "https://196.202.5.151:9017",
    name: 'My App Name',
  },
"oAuthConfig": {
    "issuer": "https://localhost:44334",
    "redirectUri": "http://localhost:4200",
    "clientId": "My_App",
    "responseType": "code",
    "scope": "offline_access openid profile role email phone AppName"
},
"apis": {
    "default": {
        "url": "https://localhost:44334",
        "rootNamespace": "AppName"
    }
}

}

But I the system did not work, I got error in console (Cannot read property 'responseType' of undefined) we changed the json again to be:

{

"application": {
	"baseUrl" : "https://196.202.5.151:9017"
  },
"oAuthConfig": {
    "issuer": "https://localhost:44334",
    "redirectUri": "http://localhost:4200"
},
"apis": {
    "default": {
        "url": "https://localhost:44334",
        "rootNamespace": "AppName"
    }
}

}

The front end worked properly with anonymous but the Identity server gave an error: Failed to validate the token. Microsoft.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: IDX10501: Signature validation failed. Unable to match key: kid: 'System.String'.

I also tried other solution mentioned in the thread of github issues but all of them did not work, Please provide us with required steps to fix this. Thank you


2 Answer(s)
  • User Avatar
    0
    bunyamin created

    Hello,

    It seems that you are not setting mergeStrategy of removeEnv. Could you set it mergeStrategy: 'overwrite' as shown in the docs and try?

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06