react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Adding custom parameters

Open kholiavko-roman opened this issue 9 years ago • 7 comments

Hello, can anybody help me, how to add custom params to my POST request ? I need add some id of user, and send it using GET request is not good idea. In docs I found only httpHeaders parameters, that allow to send headers, but how to send some extra params I didn't found.

kholiavko-roman avatar Jun 30 '17 14:06 kholiavko-roman

I have same requirement to pass location with user id as params. @kholiavko-roman do you find some thing.

anil-kumar-singh avatar Aug 03 '17 04:08 anil-kumar-singh

@kholiavko-roman @anil-kumar-singh One way of solving this would be to use an authentication token (e.g. JWT) and pass that in the httpHeaders.

tomatopeel avatar Aug 03 '17 09:08 tomatopeel

@anil-kumar-singh, I sloved my problem by adding option which add custom parameters to request, if you nedd it, I cat make PR. (I made it only for android)

@tomatopeel, thanks, but I need send not only auth key, but some additional params.

kholiavko-roman avatar Aug 07 '17 12:08 kholiavko-roman

Why don't you add requested params into url? https://server:port/?param1=value1&param2=value2. Simple as that.

EDIT:

I need add some id of user, and send it using GET request is not good idea.

It's not good idea, only when using plain http, because urls are often logged in intermediate proxies. Even if we ignore proxy logging fact, sending sensitive information via unencrypted channel is terrible idea. But if you use https, sending user id in url is perfectly fine, as only domain name is sent unencrypted.

Some may argue, that sensitive information might appear in your own server logs. That's true, however I suppose you can secure your own server to prevent information leakage from the logs.

mauron85 avatar Aug 07 '17 13:08 mauron85

As I sad in my case I think this is not safe. Anyway, thanks for advice!

kholiavko-roman avatar Aug 07 '17 13:08 kholiavko-roman

Intentionally I didn't add any POST params, as I don't see any use case, that could not be done with url params or httpHeaders. Why is your use case so special? Really curious.

mauron85 avatar Aug 07 '17 14:08 mauron85

My case in not special, just I prefer think that send auth key in get params it is not safe. Maybe I wrong.

kholiavko-roman avatar Aug 08 '17 14:08 kholiavko-roman