-
Notifications
You must be signed in to change notification settings - Fork 73
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
Returning accounts go first in getUserInfo #483
base: main
Are you sure you want to change the base?
Changes from 3 commits
be49ab5
b1a303d
1a80739
2d7c73e
a7356b4
e5dffdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1204,23 +1204,28 @@ When invoking the {{IdentityProvider/getUserInfo()}} method given an {{IdentityP | |
{{DOMException}}. | ||
1. Let |accountsList| be the result of [=fetch the accounts list=] with |config|, |provider|, | ||
and |globalObject|. | ||
1. Let |hasReturningAccount| be false. | ||
1. For each |account| in |accountsList|: | ||
1. If |account|["{{IdentityProviderAccount/approved_clients}}"] is not empty and it does not | ||
[=list/contain=] |provider|'s {{IdentityProviderConfig/clientId}}, continue. | ||
1. Let |isReturningAccount| be a new [=list=] of the same length as |accountsList|, with all | ||
values initially set to false. | ||
1. For each |i| from 0 to the length of |accountsList| minus 1: | ||
1. Let |account| be |accountsList|[|i|]. | ||
1. If |account|["{{IdentityProviderAccount/approved_clients}}"] is not empty: | ||
1. If |account|["{{IdentityProviderAccount/approved_clients}}"] [=list/contain=] | ||
|provider|'s {{IdentityProviderConfig/clientId}}, set |isReturningAccount|[|i|] to true. | ||
npm1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Note: this allows the [=IDP=] to override whether an account is a returning account. | ||
This could be useful for instance in cases where the user has revoked the account | ||
out of band. | ||
|
||
1. [=Compute the connection status=] of |provider|, |account|, and |globalObject|. If the | ||
result is [=compute the connection status/connected=], set |hasReturningAccount| to | ||
1. Otherwise, [=compute the connection status=] of |provider|, |account|, and |globalObject|. If the | ||
result is [=compute the connection status/connected=], set |isReturningAccount|[|i|] to | ||
true. | ||
1. If |hasReturningAccount| is false, [=reject=] |promise| with a new "{{NetworkError}}" | ||
{{DOMException}}. | ||
1. If |isReturningAccount| does not [=list/contain=] true, [=reject=] |promise| with a new | ||
"{{NetworkError}}" {{DOMException}}. | ||
1. Let |userInfoList| be a new [=list=]. | ||
1. For each |account| in |accountsList|: | ||
1. [=list/Append=] an {{IdentityUserInfo}} to |userInfoList| with the following values: | ||
1. Let |notReturningUserInfos| be a new [=list=]. | ||
1. For each |i| from 0 to the length of |accountsList| minus 1: | ||
1. Let |account| be |accountsList|[|i|]. | ||
1. Let |userInfo| be an {{IdentityUserInfo}} with the following values: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or at least in the IdentityUserInfo? that way we can expose it to the webpage There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a broader change (adding a webexposed member to the IdentityUserInfo. The goal of this PR is to fix a bug in the existing returned values. |
||
|
||
: {{IdentityUserInfo/email}} | ||
:: |account|["{{IdentityProviderAccount/email}}"] | ||
|
@@ -1230,6 +1235,9 @@ When invoking the {{IdentityProvider/getUserInfo()}} method given an {{IdentityP | |
:: |account|["{{IdentityProviderAccount/given_name}}"] | ||
: {{IdentityUserInfo/picture}} | ||
:: |account|["{{IdentityProviderAccount/picture}}"] | ||
1. If |isReturningAccount|[|i|], [=list/append=] |userInfo| to |userInfoList|. | ||
1. Otherwise, [=list/append=] |userInfo| to |notReturningUserInfos|. | ||
1. [=list/Extend=] |userInfo| with |notReturningUserInfos|. | ||
1. [=Resolve=] a new {{Promise}} with |userInfoList|. | ||
</div> | ||
|
||
|
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.
Should this be on the accounts, rather than adding a new boolean?
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.
The accounts are dictionaries parsed from the IdP's response, so we cannot add properties to them.