Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually calling APIs without adding the correct RID header can result in a 404 #202

Closed
5 tasks done
nkshah2 opened this issue Oct 29, 2021 · 0 comments
Closed
5 tasks done
Assignees
Labels
bug Something isn't working

Comments

@nkshah2
Copy link
Contributor

nkshah2 commented Oct 29, 2021

Problem

If a user calls one of our APIs manually and does not add the rid header, the API fails with a 404.

Ideal outcome

The API should behave the same way it does when the SDK calls the API internally

Root Cause

In the frontend SDKs when a user calls an API with interception enabled and without adding the rid header, the request interceptor adds rid: "session" by default. For APIs that dont belong to the session recipe the middleware rejects the request path and a 404 can be thrown.

Workarounds

Manually adding a valid rid in the request headers resolves this issue

Permanent fix (Possible solution)

The frontend SDKs should use a custom default rid header ("anti-csrf" for example) and the backend SDK should handle this header value the same way it handles requests having no rid header (i.e undefined). This will result in the middleware looping through all available recipes to route the API request correctly

SDKs

  • website
  • react-native
  • nodejs
  • golang
  • python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants