cancel
Showing results for 
Search instead for 
Did you mean: 

Hybrid Testing : Unauthorized error

somnathsap
Explorer
801

Hi,

I have create a sample CAP application . and choose managed approuter(I am planning to add any UI for now)

I have deployed application to cloud foundry. And bind db,xsuaa which reflected in cdsrc-private.json.
But when I am try to run command (cds watch --profile hybrid). It only load DB information but no XSUAA information.

Resulting Unauthorized error from local. I even checked service in postman with (XSUAA client information) I am getting success.

Another point to be notice , Earlier I have used CDS version 6 that time it works properly.
Please help me on this.

View Entire Topic
hasanciftci
Explorer
0 Kudos

Hi,

We are having the same issue after CDS version 7. When I use "uaa" instead of "auth" in package.json cds.requires section, I don't get 401 and I successfully access. But when we leave it as "auth" and use cds bind -2 command, we are facing 401 unauthorized issue. Perhaps, david.kunz2 can help us here. This problem started occurring after CDS 7.

somnathsap
Explorer
0 Kudos

It seems it might have any connection cds.requires.uaa field. I am not sure on this.
Is there any "auth" entries in the cdsrc-private.json when u able to access the service ?
david.kunz2 : Can please help us on this issue?

david_kunz2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Somnath,

cds.requires.uaa is deprecated. Please use cds.requires.auth instead. This will secure your endpoints and HTTP status code 401 (unauthorized) is expected when accessing them without access rights. Did you provide a proper JWT token when sending the requests?

somnathsap
Explorer
0 Kudos

Hi david.kunz2 ,

Thanks for your reply.
I am not sending any jwt token. Actually I have added sample(Book) application and configured managed approuter(from mta.yaml). and add simple list-report fiori app.
Then I have done mta build and deploy. After that I have bind ed db,xsuaa,destiontion service (cds bind -2) with keys.
And run cds watch --profile hybrid. It giving unauthorized. But If I change cds 7 to 6. it started working.
I have tried hit odata(CDS 7) via postman (oath2) it worked. But couldnt run locally

david_kunz2
Product and Topic Expert
Product and Topic Expert
0 Kudos

During development, you can also use mocked authentication (via a development profile), then you don't need any JWT tokens.

somnathsap
Explorer
0 Kudos

But I have done have any scope and I want to test cds service bindings. Why its started working if I degrade cds version to 6? But doesn't work with 7

shubhamd_27
Participant
0 Kudos

Hi Somnath,

I am facing a similar issue, did you find any solution.

Regards,
Shubham

somnathsap
Explorer
0 Kudos

Hi shubham_27d94 ,
Yes I found out. U need to run local approuter in 5000 port. Other instance in 4004. U need always test the application from 5000.
I know its different than cds 6. But it works