on 05-10-2023 5:51 AM
Hello,
I'm encountering some issues when performing the exercise related to the CDS Restrictions and Roles. Here is the link for reference: https://learning.sap.com/learning-journey/build-side-by-side-extensions-on-sap-btp/defining-cds-rest...
When testing the project in the BAS local environment, I'm not getting the prompt that will allow me to enter a mock user and password. Here is the expected result:
As a result, I'm receiving the 401 Unauthorized error. Note that this is only happening in BAS. Once the CAP Project is deployed to BTP and the role collection is assigned to my User ID, I'm able to run the app successfully.
So it looks like an isolated case when performing some tests locally using mock user. Can you please advise how to address this? Thanks!
I found a solution that allows you to change a user. Add `username:password@` before the domain in the URL.
http://usr:pwd@localhost:4004/.
StackOverflow ref: https://stackoverflow.com/questions/50528467/how-to-add-login-credentials-to-url
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
did you find any solution for this, I am facing same issue. I have configured my users for local testing, and trying with basic authorization.It prompts for user trying to login with confugured users, but getting 401 autorization error. Have tried in incognito too.
Thanks In advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi mvillanuev29
This looks to me like you've not setup the authentication correctly for local use. In the CDS configuration (either package.json or .cdsrc.json) for your project you should be using mocked authentication locally and XSUAA in 'production'. I think you may be set to always use XSUAA and so locally this is failing (as expected).
If you need me to point you to the relevant documentation for this, please let me know.
Thanks
John
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi mvillanuev29 ,
Sometimes the browser caches the user credentials, maybe it will ask for username and password once you clear the cache?
Best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've been frustrated with this same issue while developing locally. How exactly do we get the browser (Chrome or Edge) to forget the user data? I've tried clearing cookies and "Clear site data" under "Application" and still there doesn't seem to be a way to "refresh" the user.
I'm trying to develop `@restrict` on some entities and making changes to the mock users in the `package.json` file. But when inspecting the queries, the user roles and attrs are still the old settings from long ago and I really need them refreshed to the current settings.
Thank you for any tips!
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.