-
Hi, I'm trying to use remote apis and just wondering if it's possible to do something like this: app.MapRemoteBffApiEndpoint("/api/books", $"https://remoteHost/users/{userId}/books") Where userId is retrieved from the I know I can use embedded apis for this, but seeing if there is a shortcut for this as I don't currently need to do any logic or transformation, just use the user id from the token. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The easiest method to go about this, would be to move the responsibility for generating the user-specific route on the frontend:
Another way to solve this on the BFF side, is to add a local API endpoint. In that endpoint's handler code, you can then also extract the There may be another way to solve this that more aligns with your suggestion, but that will rather require custom Yarp configuration and extensions, which is out of scope for our BFF library. |
Beta Was this translation helpful? Give feedback.
The easiest method to go about this, would be to move the responsibility for generating the user-specific route on the frontend:
/bff/user
endpoint. This gives you thesub
claim to use asuserId
in the API route.https://bffHost/api/users/{sub-claim-value}/books
Another way to solve this on the BFF side, is to add a local API endpoint. In that endpoint's handler code, you can then also extract the
sub
claim for the current user and call the remote API.There may …