-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
docs: introduce doc on authentication #3404
Conversation
docs/auth.md
Outdated
window.localStorage.setItem(key, entries[key]); | ||
}); | ||
} | ||
}, [localStorage]); |
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.
nit: can just pass localStorage
without an array wrap. The function would be easier as well: storage => {...}
.
docs/auth.md
Outdated
window.sessionStorage.setItem(key, entries[key]); | ||
}); | ||
} | ||
}, [sessionStorage]); |
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.
Same here.
docs/auth.md
Outdated
* In Jest, this can be executed in [`globalSetup`](https://jestjs.io/docs/en/configuration#globalsetup-string). | ||
3. In each test, load authentication state in `beforeEach` or `beforeAll` step. | ||
|
||
This lifecycle can be extended to cache authentication state across test runs. |
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 didn't quite understand this sentence.
docs/auth.md
Outdated
|
||
## Persistent authentication | ||
Web browsers use a directory on disk to store user history, cookies and other local | ||
state. This is directory is called the [User data directory](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md). |
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.
typo: double "is"
docs/auth.md
Outdated
Web browsers use a directory on disk to store user history, cookies and other local | ||
state. This is directory is called the [User data directory](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md). | ||
|
||
User data directory is an alternate approach to reusing authentication state. 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.
I'd rather advertise persistent context for persisting storage, e.g. IndexedDB. I think we should push towards non-persistent auth when we can.
docs/auth.md
Outdated
- [class `BrowserContext`](./api.md#class-browsercontext) | ||
- [`browserType.launchPersistentContext`](./api.md#browsertypelaunchpersistentcontextuserdatadir-options) | ||
|
||
## Multi-factor authentication |
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.
This sounds like a better sell for persistent context. Let's merge with previous section?
(needs some more word-smithing - especially in the intro section, but ready for feedback)
This PR introduces a new doc on authentication, covering scenarios that I've seen come up frequently.
Drive-by: clean-up for
context.setHTTPCredentials
since we don't recommend using it anymore.