You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- How to test authentication that uses a third-party provider, like GitHub (usually OAuth).
4
+
5
+
## Approaches
6
+
7
+
1. Test users. Create an actual user of your third-party server and use their credentials in tests.
8
+
- Pros:
9
+
- Actual user.
10
+
- Running OAuth fully.
11
+
- Cons:
12
+
- Rigid. Need different user states? Have to create different users.
13
+
- Brittle. Some providers dislike automation in general and might block your test user.
14
+
1.**API mocking + test data**. Intercept the OAuth flow and respond with mocked data. Requires you to have a mock user, too.
15
+
- Pros:
16
+
- Full control. Tap into any user/OAuth state/behavior.
17
+
- Cons:
18
+
- OAuth never really runs (not a bad thing).
19
+
- Coupled to the provider. You MUST replicate the network flow + data structures used by the provider in real life. Great if they ship some SDKs or typedefs to help you out. Not so great if you have to type it by hand (risk getting stale).
0 commit comments