Commit 9ef1e1a
authored
Explicitly load credentials from Firebase (#1611)
* Log uncaught errors from sagas to the console
* Explicitly load credentials from Firebase
When Popcode first integrated Firebase, the Firebase client stored
provider credentials and exposed them in the `onAuthStateChange`
callback. However, that changed a long time ago, obliging us to store
provider credentials in the Firebase database.
At the time, I decided to keep the interface of the Firebase client the
same, keeping the storage and retrieval of credentials abstracted from
the caller (in this case, the saga). Ultimately, this was a
path-dependent outcome, and there’s no reason the saga shouldn’t just
handle that task itself.
With an eye toward both becoming more robust to mismatches between
stored credential information and actual linked accounts; and to loading
and storing more information about the user’s provider accounts
(specifically the provider profiles), move handling of credential
persistence into the saga.
While in general we’re able to handle this reasonably elegantly in
the saga, there is one wrinkle, which is that the channel for auth
state changes fires regardless of whether the auth state change is
due to an explicit user action or an implicit change (e.g. the user
logged in/out in a different tab). Oddly, the Firebase client fires the
auth state change handler _before_ resolving the promise returned by
the call to log in.
So, when the user logs in explicitly, we now wait for the promise to
resolve (which gives us a credential we want to store and use), and
in parallel we pull the next auth state change off the channel, simply
discarding it, since it’s redundant with the login promise but contains
less information.
* Disable “ghost mode” for BrowserStack
Also set a couple of other useful options1 parent 989a008 commit 9ef1e1a
File tree
15 files changed
+496
-294
lines changed- src
- channels
- clients
- sagas
- test
- helpers
- unit
- reducers
- sagas
15 files changed
+496
-294
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
144 | 146 | | |
| 147 | + | |
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
| 1 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
| |||
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 61 | + | |
| 62 | + | |
69 | 63 | | |
70 | | - | |
71 | 64 | | |
72 | 65 | | |
73 | 66 | | |
| |||
107 | 100 | | |
108 | 101 | | |
109 | 102 | | |
110 | | - | |
| 103 | + | |
111 | 104 | | |
112 | 105 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 106 | + | |
| 107 | + | |
126 | 108 | | |
127 | 109 | | |
128 | 110 | | |
| |||
135 | 117 | | |
136 | 118 | | |
137 | 119 | | |
138 | | - | |
139 | 120 | | |
140 | 121 | | |
141 | 122 | | |
| |||
145 | 126 | | |
146 | 127 | | |
147 | 128 | | |
148 | | - | |
| 129 | + | |
149 | 130 | | |
150 | | - | |
151 | | - | |
| 131 | + | |
152 | 132 | | |
153 | 133 | | |
154 | 134 | | |
| |||
174 | 154 | | |
175 | 155 | | |
176 | 156 | | |
177 | | - | |
| 157 | + | |
178 | 158 | | |
179 | 159 | | |
180 | 160 | | |
| |||
235 | 215 | | |
236 | 216 | | |
237 | 217 | | |
238 | | - | |
| 218 | + | |
239 | 219 | | |
240 | 220 | | |
241 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
242 | 230 | | |
243 | 231 | | |
244 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
0 commit comments