Skip to content
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

Add API to show error messages from failed token fetches #498

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

npm1
Copy link
Collaborator

@npm1 npm1 commented Aug 30, 2023

Adds the capability for the FedCM API to show error dialogs in certain scenarios after the user has chosen to perform federated login with an account. For this purpose:

  • An IdentityCredentialError is created, which may contain an error which is a string that contains the specific error, and the user agent may use to customize the UI). It may also contain url, in case the IDP wants to show a url where the user could get more information.
  • Shows error UI when there are network errors or when the IDP returns that an error has occurred.

Fixes #488


Preview | Diff

@npm1 npm1 requested a review from yi-gu August 30, 2023 21:40
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Show resolved Hide resolved
spec/index.bs Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
@npm1
Copy link
Collaborator Author

npm1 commented Sep 1, 2023

Ready for another look @yi-gu

Copy link
Collaborator

@yi-gu yi-gu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM!

@npm1
Copy link
Collaborator Author

npm1 commented Sep 1, 2023

Hey @bvandersloot-mozilla @martinthomson @cboozar requesting Mozilla to take a look.

spec/index.bs Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
Copy link
Collaborator

@cbiesinger cbiesinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, lgtm

spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Show resolved Hide resolved
spec/index.bs Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
@samuelgoto
Copy link
Collaborator

@npm1 just checking: is there anything else we need to act on before we merge this?

@npm1
Copy link
Collaborator Author

npm1 commented Feb 27, 2024

@npm1 just checking: is there anything else we need to act on before we merge this?

Yes, I need to rebase and change the code to whatever we agree on (awaiting @bvandersloot-mozilla's confirmation about whether error is acceptable)

@npm1 npm1 added the agenda+ Regular CG meeting agenda items label Jul 25, 2024
Copy link
Collaborator

@bvandersloot-mozilla bvandersloot-mozilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to make this web-observable and doing so risks leaking information to the RP about shared browser state.

@npm1
Copy link
Collaborator Author

npm1 commented Jul 31, 2024

I don't think we need to make this web-observable and doing so risks leaking information to the RP about shared browser state.

What is 'this'? And can you elaborate on the leak you are thinking about?

@bvandersloot-mozilla
Copy link
Collaborator

"this" is the IdentityCredentialError itself, particularly the code variable which contains an unspecified string (presumably one of "invalid_request", "unauthorized_client", "access_denied", "server_error", and "temporarily_unavailable"). If I understand this patch correctly, that ends up returned from navigator.credentials.get and reveals internal information about the credential discovery to the RP.

@npm1
Copy link
Collaborator Author

npm1 commented Aug 1, 2024

"this" is the IdentityCredentialError itself, particularly the code variable which contains an unspecified string (presumably one of "invalid_request", "unauthorized_client", "access_denied", "server_error", and "temporarily_unavailable"). If I understand this patch correctly, that ends up returned from navigator.credentials.get and reveals internal information about the credential discovery to the RP.

That is correct, but the IdP needs to set this value itself in the response in order for it to be passed to the RP (it is not 'leaked'). Also perhaps worth noting that the error is passed from the ID assertion fetch, so the user must have tried to use FedCM in the RP.

@bvandersloot-mozilla
Copy link
Collaborator

Ah, I didn't realize this is happening on the id assertion endpoint only. In that case, this is reasonable, but we should probably enumerate the possible values for code and specify when they are returned.

@npm1
Copy link
Collaborator Author

npm1 commented Aug 1, 2024

Ah, I didn't realize this is happening on the id assertion endpoint only. In that case, this is reasonable, but we should probably enumerate the possible values for code and specify when they are returned.

I was hoping to leave the values for error (previously code) unspecified similar to how we do not specify the format/return of token. That way the IdP can send the information needed for the RP to process the error, and the user agent may choose to show generic UI or show more specific UI if it chooses to do so based on the error string. What do you think? I did mention the strings Chrome uses to show more specific UI in case it is of interest for an implementor to match.

Copy link
Contributor

@TallTed TallTed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small tweaks for clarity

spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
spec/index.bs Outdated Show resolved Hide resolved
@npm1
Copy link
Collaborator Author

npm1 commented Aug 27, 2024

Putting this on hold to get some discussion with other WGs on error handling, hopefully to occur during TPAC.

@npm1 npm1 removed the agenda+ Regular CG meeting agenda items label Aug 29, 2024
@npm1
Copy link
Collaborator Author

npm1 commented Sep 19, 2024

Rebased this PR in case people want to take another look ahead of TPAC discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Users may be confused after showing intent to sign in but the sign-in is failed
6 participants