cancel
Showing results for 
Search instead for 
Did you mean: 

CAP Autentication error

pedroroquero
Associate
Associate
0 Kudos

Hello all,

I am trying to develop a CAP application to expose Hana Cloud tables as OData services so that I can use them later. Creating this application, I am running into the error:

Authentication kind "jwt" configured, but no XSUAA instance bound to application. Either bind an IAS instance, or switch to an authentication kind that does not require a binding.


In the package.json file I have specified this:

pedroroquero_0-1713962777377.png

The problem is that when I change the jwt with xsuaa I get the same error but saying I should use IAS instance. And with the IAS I get the same error too.

I have also tried with a dummy or mocked authentication. When I used those, I go a bit further on the process but then I get an error saying:

"Error: No database credentials provided","at credentials4 (/home/user/projects/MyHANAApp/node_modules/@sap/cds/libx/_runtime/hana/pool.js:22:27)"

I have created this application following this tutorial : https://community.sap.com/t5/technology-blogs-by-sap/use-cap-to-expose-hana-cloud-tables-as-odata-se...

Does anyone know how to solve this problem?

Best regards.

 

View Entire Topic
Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi @pedroroquero,

I believe you are mixing somethings here. When you say you have XSUAA configured for your application, that simply means you have the "business user" authenticated - usually this happens when you call an app like SAP App Router. It will forward the authentication request to an IdP, and then after it gets the SAML token, it then generates a JWT token that can be forwarded to a microservice as means of authentication. However, that authentication flow is only relevant for inter-communication of microservices. For instance, a microservice (App Router) calling another microservice (CAP srv module). On that case you will be using a JWT for authentication.

On the other hand, CAP also deals with the communication to a backing service - which in this case is a HDI container in a HANA Cloud instance. So you must have your src module bound to an instance of an HDI container. That "binding" will create the necessary environment variables on your srv application (and on your database deployer module as well). On the environment variables, the application will be able to retrieve the HDI ID, jdbc connection string and database users. There will be a runtime user and a design time user available on the environment variables. The DT user will be used by the deployer in order to perform all DDL changes onto the HDI Container. The srv module will use the RT user to run any SQL statements against the database schema. 

My understanding is that your srv module is not bound to an HDI container or your HANA Cloud instance is not up-and-running as it should be.

Also, your cds statement on the package.json is using database kind as 'sql' - which should be 'hana' as per documentation:
https://cap.cloud.sap/docs/guides/databases#auto-wired-configuration

Please check those.

Best regards,
Ivan