cancel
Showing results for 
Search instead for 
Did you mean: 

No User Prompt When Testing CAP Project Locally in BAS

mmarkvillanueva
Explorer

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:

mmarkvillanueva_0-1683604820166.png

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!

View Entire Topic
david_kunz2
Advisor
Advisor
0 Kudos

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

mmarkvillanueva
Explorer
0 Kudos

Hi david.kunz2

Thanks for your reponse. I've tested also by deleting browser cache and running in incognito mode, but stil faces the same problem.

david_kunz2
Advisor
Advisor
0 Kudos

Hi mvillanuev29 ,

Can you send HTTP requests using curl (command line)? That way, we can check if the server actually requires user credentials.

mmarkvillanueva
Explorer
0 Kudos

Hi david.kunz2 ,

Here's a screenshot of curl command.

Here's a screenshot when I add credentials.

david_kunz2
Advisor
Advisor
0 Kudos

Thanks! Then the CAP server seems to work properly. Maybe it helps if you use Incognito Mode?

mmarkvillanueva
Explorer
0 Kudos

Hi david.kunz2,

I already tested in Incognito Mode and got the same error.

david_kunz2
Advisor
Advisor
0 Kudos

Ok, that means the browser just doesn't require you to enter the credentials (instead of using previously stored ones). Maybe the Fiori Elements/BAS colleagues can comment?

JWJ
Participant

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!

johnmurray
Participant
0 Kudos

The best way is to just use incognito mode, as then you can simply close that session and start a new one. It's much easier than messing about trying to delete the cookies and cache.