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

docs: introduce doc on authentication #3404

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

arjunattam
Copy link
Contributor

(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.

docs/auth.md Outdated
window.localStorage.setItem(key, entries[key]);
});
}
}, [localStorage]);
Copy link
Contributor

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]);
Copy link
Contributor

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.
Copy link
Contributor

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).
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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?

@arjunattam arjunattam merged commit 06ddacd into microsoft:master Aug 12, 2020
@arjunattam arjunattam deleted the auth-docs branch August 12, 2020 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants