Skip to Main Content

API, CLI, SDK & Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

idcs v1/sdk/authenticate

DEEPA RAOFeb 3 2025

Hi,

I have a nodejs application that calls the /sso/v1/sdk/authenticate api for authentication.

https://docs.oracle.com/en/cloud/paas/identity-cloud/rest-api/op-sso-v1-sdk-authenticate-post.html

The api is called in a server side function using axios. When we collect the idcs logs, we noticed that the clientIp property always shows the server's ip. This makes sense in that the api is being called in a server side function. Is there a way I can pass the client's real ip to the IDCS api so that the logs display the actual client ip instead of the server ip. The Call is as below :-

Appreciate any help in this regard.

// Capture the real client IP address
const clientIp = req.headers['x-forwarded-for']?.split(',')[0] || 
req.headers['x-real-ip'] ||
req.socket.remoteAddress ||
req.socket.remoteAddress ||
req.ip;

const sdkAuthResponse = await axios.post(process.env.IDCS_URL+'/sso/v1/sdk/authenticate', bodyreq, {
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer ' + bearerToken,          
        'X-Client-IP': clientIp,
        'X-Forwarded-For': clientIp,
        'X-Real-IP': clientIp
      }
    });
This post has been answered by DEEPA RAO on Feb 21 2025
Jump to Answer
Comments
Post Details
Added on Feb 3 2025
1 comment
229 views