-
Notifications
You must be signed in to change notification settings - Fork 380
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
chore: implement Internet Identity example recommendations #1033
base: master
Are you sure you want to change the base?
Conversation
window.authClient.login({ | ||
identityProvider: process.env.II_URL, | ||
onSuccess: () => { | ||
setActor(window.authClient); |
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.
Do you remove the login button onSuccess?
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.
No, I didn't notice that logic in the original version
|
||
let actor = greet_backend; | ||
// Global variables that we will set up |
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.
// Global variables that we will set up | |
// Global variables for convenience while you're becoming familiar with the interface. You should use local variables or closures in production |
Here are some recommendations I have on best practices in the II example project.
Important and functional changes
create
should not be invoked during thelogin
flowclick
event leads browsers to treat the interaction as a popup and reject it. This is a particular footgun for Safari mobilelogin
button andgreet
button until the authClient is readyPromise
wrapping oflogin
await
is fancy, but the actual browser API is based around callbacks and events, andonSuccess
andonError
are adequate.reject
ed in theonError
callbackLess important (semantic HTML, a11y, and style)
window.greetActor
andwindow.authClient
instead of local variables so new devs can play with the objects in the console. We DO NOT have to accept this change - it's just an idea I hadform
elements are unnecessary withoutinput
elements, and don't add any semantic value. I prefer<button type="button">
over an empty form, and then we don't need to handlesubmit
events