-
Notifications
You must be signed in to change notification settings - Fork 602
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
Torii restore generic data #1310
Torii restore generic data #1310
Conversation
b5ec121
to
74e1ccf
Compare
Looks like there's some tests failing on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the use case for this. The authenticated
object in the session data is managed by ESA and supposed to ever be written by the app.
return authenticator.restore({ some: 'data', provider: 'provider' }).then((data) => { | ||
expect(data).to.eql({ some: 'other data', provider: 'provider' }); | ||
return authenticator.restore({ some: 'data', provider: 'provider', other: 'unrelated data' }).then((data) => { | ||
expect(data).to.eql({ some: 'other data', provider: 'provider', other: 'unrelated data' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would other
end up in the authenticated session data in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, other
is part of the data resolved by a custom authenticator.authenticate()
method.
I'll put an example together shortly.
74e1ccf
to
7f29799
Compare
Previously, generic `sessionData` was being clobbered be the data returned by Torii.fetch. Now, generic sessionData is preserved and the result of Torii.fetch is merged into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I got what this solves now and fixed the test 👍
7f29799
to
10e673c
Compare
Great! Sorry I never got around to providing a better example! |
I think I've found a small bug in
authenticator:torii
. It seems that onrestore
, session data (possibly resolved by extra functionality inauthenticate
) is being clobbered by the data returned fromthis.get('torii').fetch()
.I've updated a test with some generic data to demonstrate a failing result and including a fix that simply merges the
sessionData
passed intorestore
with the data returned from the.fetch()
call.Let me know if I'm missing something here, or if you'd like anything changed/updated.