cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to Use JWT Cookies for Authentication in SAPUI5 with OData V2/V4 (CAPM(node.js) in backend

sumitjhal
Newcomer
0 Likes
288

Hi SAP Community,

I am working on a SAPUI5 frontend with a CAPM (Node.js) backend and have implemented a custom authentication mechanism using JWT tokens. Here’s my setup:

  • My CAPM backend initially had an unauthenticated service but later, I added JWT-based authentication.
  • Upon successful OTP verification, I inject a JWT token as an HTTP-only cookie in the response.
  • In the frontend, I am using SAPUI5 with OData V2 and V4 services.
  • I have also implemented Bearer authentication but now I am facing issues in using the JWT cookie for authenticated requests in the frontend.

My Questions:

  1. How can I use the JWT cookie in SAPUI5 when making OData V2 and OData V4 (both) requests?
  2. How do I correctly set the headers or configure authentication in SAPUI5 to use the JWT token from cookies?

Since the token is stored in an HTTP-only cookie, I cannot directly access it in JavaScript. I would really appreciate any guidance on handling authentication with JWT in SAPUI5 when using OData services.

I have also attached a sapui5 odatav4 call in which i have tried to add header in the odatav4 call but unfortunately it didn't worked ! 

Thanks in advance!Racxam 2025-01-31 at 1.08.44 PM.png

Accepted Solutions (0)

Answers (0)