Invalid search criteria when passing queryParameters to listApplications method
Shrirang97 opened this issue · 2 comments
Shrirang97 commented
Current behavior
queryParameters = { filter: `user.id+eq+"` + userId + `"`, expand: 'user/' + userId };
oktaClient
.listApplications(queryParameters)
.each(oktaApplication => {});
Doc Link: https://developer.okta.com/docs/reference/api/apps/#request-example-14
Behaviour: Giving error as Invalid Search Criteria
Expected behavior
It should return list of applications
Minimal reproduction of the problem with instructions
Try above code with then & catch.
Environment
- OS: Mac
- Node.js version: 14.17.1
Code issue
https://github.com/okta/okta-sdk-nodejs/blob/master/src/generated-client.js
qs.stringify
method is encoding characters like +
, "
, \
in query parameters giving output as %2B
, %22
, %2F
.
denysoblohin-okta commented
You should use " " instead of "+" in filter:
queryParameters = { filter: `user.id eq "${userId}"`, expand: `user/${userId}` };
See docs for filter
In this example " " is already encoded into "+" in request URL
Shrirang97 commented
Thanks for pointing it out!