This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-01
Channels
- # beginners (133)
- # boot (59)
- # cider (5)
- # cljs-dev (30)
- # cljsrn (23)
- # clojure (212)
- # clojure-austin (3)
- # clojure-brasil (1)
- # clojure-chicago (5)
- # clojure-italy (10)
- # clojure-russia (5)
- # clojure-serbia (1)
- # clojure-spec (34)
- # clojure-turkiye (2)
- # clojure-uk (132)
- # clojurescript (163)
- # clojutre (1)
- # cursive (5)
- # datomic (58)
- # emacs (42)
- # events (1)
- # graphql (26)
- # hoplon (16)
- # jobs (1)
- # lumo (27)
- # numerical-computing (3)
- # off-topic (127)
- # om (9)
- # onyx (24)
- # re-frame (20)
- # reagent (20)
- # ring-swagger (14)
- # sql (19)
- # unrepl (28)
- # untangled (3)
- # vim (8)
- # yada (17)
@aj, cookies are handled transparently by react-native, i.e. they are stored in a per-app cookie jar
they persist across app restarts, so as long as you use the regular JavaScript network request libs (js/fetch), you don't need to do anything
@pesterhazy by any chance do you have an example?
@carocad of using fetch
?
no, I already use fetch. In my case I call fetch on app start to get the tokens. Since that process always takes a while my guest was that nothing was being persisted. But you said that they are persisted transparently so if I call fetch with the same address as before, does it uses the known answer? i am a bit confuse sorry
it works just like on the web - RN acts like a web browser
> In my case I call fetch on app start to get the tokens I'm not sure if I got your authentication scenario right, but… If you get auth tokens back in the server response, then you have to manually save them (for example with AsyncStorage) on the devise and manually add them as headers to sub-sequent fetch calls. What @pesterhazy is talking about with automatic save is just cookies and will work if you have cookie-based authentication (not token-based).
ah you mean a token as in JWT?
yeah you'll have to set headers and store tokens manually then
(What's wrong with cookies? Why do people keep reinventing them?)
> What's wrong with cookies? Why do people keep reinventing them? I keep asking myself that… No idea 😞
@pesterhazy well in the case of jwt they are self-signed
. So there is no need to store the token safely. Any storage will work since the server can verify it. They are also stateless
so no need to keep track of current sessions on both client and servers
can't you do that with cookie too? E.g. ring.middleware.session.cookie/cookie-store https://github.com/ring-clojure/ring/wiki/Sessions#session-stores
not sure if I understand that right, but that means that you still need to store the cookie in the server right?
I am actually not very qualified to explain the whole thing since I am still learning about it but I think this blog post can explain it better https://auth0.com/blog/cookies-vs-tokens-definitive-guide/
no, an encrypted cookie can be client-side only (that's a best practice too)
if you have a choice in the matter, consider not buying into the JWT hype, it may not be worth it for your use case
well I dont really have a choice for this. I am using external authentication services g+ facebook, etc
so I have to work with what I have at hand and I also dont want to reinvent the wheel (i.e. provide my own auth service)
can you actually provide me some resources about that client-side cookie? I would love to know more about it
afaik it's not documented in the react-native docs, but that's how it works, just like a browser
no, an encrypted cookie can be client-side only (that's a best practice too)
afaik it's not documented in the react-native docs, but that's how it works, just like a browser