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

Parse query request interceptor #1449

Open
3 tasks done
stephannielsen opened this issue Feb 14, 2022 · 1 comment
Open
3 tasks done

Parse query request interceptor #1449

stephannielsen opened this issue Feb 14, 2022 · 1 comment
Labels
type:feature New feature or improvement of existing feature

Comments

@stephannielsen
Copy link

New Feature / Enhancement Checklist

Current Limitation

I am working on an app where we use an external authentication system based on JWT/Bearer access tokens. The solution is based on the feature added with this PR (parse-community/parse-server#6411) on server side. Now, we want to add our Bearer token to Parse query requests as described here: parse-community/docs#819.

However, apps typically renew such a bearer token quite often by using a refresh token flow etc. So we need to update the bearer token often. One solution for example would be to acquire a fresh Bearer token before every request (if needed) and then use the latest token on the request.

Feature / Enhancement Description

Pass one or many interceptor functions to Parse which are executed (in order) when a query is made. These interceptors can run asynchronous code.

Example Use Case

Append (dynamic) headers to network requests.

Alternatives / Workarounds

It is currently possible to pass custom headers via Parse.CoreManager to network requests, however these are static.
I found this issue asking for failure interceptors which are kind of similar: #19

However, the answer is quite presumptuous in my opinion. There are valid use cases for global interceptors and per request interceptors. Would be nice if the SDK provides mechanisms for both ways.

3rd Party References

Axios provides interceptors: https://axios-http.com/docs/interceptors
For native apps this is also often possible via the networking library, e.g. OkHttp for Android: https://square.github.io/okhttp/features/interceptors/

@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

2 participants