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

account.signIn() to resolve with {id, account}, but resolves with {id, username} #26

Closed gr2m closed 8 years ago

gr2m commented 8 years ago
account.signIn({username: 'pat', password: 'secret'})

currently resolves iwth

{
  sessionId: "287f3a64-df67-4384-a00d-35d0c257f798"
  username: "pat"
}

But should resolve with

{
  id: "287f3a64-df67-4384-a00d-35d0c257f798"
  username: {
    id: "account123",
    username: "pat",
    roles: []
  }
}

As showin in the README: https://github.com/hoodiehq/hoodie-client-account#accountsignin

I guess the way we serialise at the moment is not up to date with the latest spec, so other methods / tests might be needed to be adapted as well

andru commented 8 years ago

Was going to pick this one up but looks like it's already done?

I'm seeing test successful account.signIn(options) at https://github.com/hoodiehq/hoodie-client-account/blob/master/tests/unit/sign-in-test.js#L38 passes fine.

Should this be closed or am I misunderstanding the task?

gr2m commented 8 years ago

yeah the test is wrong. signIn should not resolve with accountProperties, but with sessionProperties. Meaning that accountProperties.id should be sessionProperties.account.id and accountProperties.username should be sessionProperties.account.username.

Sorry this is really confusing. But does it make sense now?

andru commented 8 years ago

Ok that's clear. I'll leave this for now, but I can pick it up when I'm done with https://github.com/hoodiehq/hoodie-client/pull/33

gr2m commented 8 years ago

closed via https://github.com/hoodiehq/hoodie-client-account/issues/44