I’m trying to get user custom property using @forge/api in a Forge app but seems like query parameter is being ignored.
Below is the URL that I’m trying to access. I have provided the accountId query parameter but I’m getting error where it says “The accountId query parameter needs to be provided”
Here is my code that uses api.asApp().requestJira(…) method.
When trying to access the same endpoint using POSTMAN, everything works fine.
I came across with this similar thread https://community.developer.atlassian.com/t/product-fetch-api-ignores-query-string/54021. I checked the forge cli version installed in my machine and I’m using the latest version at the time of this writing which is 4.5.1.
Is there’s something I’m missing?
route tagged template literal strips everything after the
? in each parameter to prevent query string injection attacks in Forge apps. You will need to make a query where the
? is not part of the interpolated parameters, for example:
See the documentation on
route here for more information. In case it helps with debugging, you should be able to see the resultant url that is being requested by running:
Hope that helps, let me know if you have any issues.
Thank you for your response.
using URLSearchParams solves my issue
However, I encounter another issue, kindly see below.
This is what I have in scopes in my manifest file.
Is there something I’m missing?
Looks like the app user used by
asApp doesn’t have permission to read user properties for this user. Maybe you might have more luck with
asUser? If not I can follow this up further.