Hello ABP,
We are trying to run the EasyCRM sample application provided in your documentation (https://abp.io/docs/latest/samples/easy-crm), but facing some issues with the Angular part of the project:
We've followed all directions from the arcticle:
- using Yarn 1.22 for package management - all packages are downloaded and installed successfully;
- the backend is running (in Visual Studio 2022);
UseDynamicDatabase
is set to false as instructed;
However, when you click any of the Login buttons - the one in the Home component, or the one in the top bar - nothing happens.There are 2 errors in the browser console, which are shown when loading http://localhost4200 (not when clicking the Login buttons). They might be related:
- invalid issuer in discovery document expected: https://localhost:44338 current: https://localhost:44338/
- ERROR TypeError: Cannot read properties of undefined (reading 'grant_type')
Is there something that we are missing, which was not mentioned in the article?
Thanks in advance!
2 Answer(s)
-
0
The error "invalid issuer in discovery document expected: https://localhost:44338 current: https://localhost:44338/" is caused by a trailing slash mismatch between the issuer URL in your Angular environment configuration and the issuer returned by your backend's OpenID Connect discovery document. ABP's Angular OAuth module performs strict validation, so both URLs must match exactly (including or excluding the trailing slash).
The error "Cannot read properties of undefined (reading 'grant_type')" is a side effect of the failed discovery document validation, which prevents the OAuth flow from initializing properly.
How to fix:
- Open your Angular project's environment configuration (typically
environment.ts
orenvironment.prod.ts
). - Locate the
oAuthConfig.issuer
property. - Make sure the value matches exactly what your backend returns in the discovery document. If your backend returns
https://localhost:44338/
(with a trailing slash), then set:
oAuthConfig: { issuer: 'https://localhost:44338/', // Note the trailing slash ... }
If it returns without the slash, remove it in the config.
- Save and restart your Angular app.
Reference:
This should resolve both the issuer validation and the grant_type errors, allowing the login buttons to work as expected.
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
Thanks for the assist, marking this as resolved