hoodiehq / hoodie-account-client

:dog: Account client API for the browser
https://hoodiehq.github.io/hoodie-account-client
Apache License 2.0
11 stars 24 forks source link

Question: why does sign in omit the session information? #162

Open dominicbarnes opened 6 years ago

dominicbarnes commented 6 years ago

Currently, the sign in method explicitly omits session on the resolved account object. I did not expect this behavior, as I was storing a single account reference and using the presence of session to determine if the user was "logged in" or not. (session is present after account.get(), but not account.signIn())

What is the main reason for this behavior? In my case, I want the session information after signing in, as I've just opened a new session. However, I'm very new to hoodie, so it's totally possible I'm misusing it right now.

In short, can/should sign in return the session information?

gr2m commented 6 years ago

hey @dominicbarnes it’s been a while I’ll have to look up the reason, but I agree it’s confusing at first sight. I think it was to make it coherent with .signUp() and .signOut(), but maybe there was something else.

You can do a hoodie.account.get('session') after the sign in

dominicbarnes commented 6 years ago

@gr2m yeah, that's exactly what I ended up doing :)