-
Notifications
You must be signed in to change notification settings - Fork 134
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
Support custom request headers #365
Comments
Hey! A a glance, this seems like a reasonable and useful request - we'll do some exploration to see if there are any caveats. in the meantime, it seems like you're already doing some massaging -have you tried passing the info that would eventually go into headers through the event properties and reform your events as needed in your backend? |
Yes, as a workaround for now, we are parsing |
Please please add this. I filed this as a support ticket a while back, & have mentioned it directly to our Amplitude reps a couple times. Our use case is exactly the same as @jshao-scw—we use a custom endpoint & need to send authorization tokens. We worked around the limitation the same way—by passing our auth tokens in the event properties. But we just discovered a further issue—Identify calls. When we use
Allowing custom headers is the much cleaner, canonical way to handle this, & should be supported if Amplitude supports custom endpoints. |
I should mention that we currently generate a unique auth hash for every network request. We might be able to relax this, but it's not certain. Therefore, rather than (or in addition to) a |
Thank you so much for adding this functionality! The SDK docs don't yet cover this new option. https://amplitude.github.io/Amplitude-JavaScript/Options/ |
Summary
Can amplitude SDK support custom request headers? Like
Motivations
Our frontend events require to flow into our backend and then to amplitude (frontend -> backend -> amplitude). We are doing so because we want to massage (by adding user information based on the
x-session-id
) the frontend events a little and then use a centralized forwarder to send events to amplitude.We still want to keep using the amplitude frontend SDK to collect the metadata information (like device ID) and queue feature. But need a way to pass our backend the auth token.
Is this possible or is there any workaround? Thanks.
The text was updated successfully, but these errors were encountered: