Commit 33c2b4e
authored
[google_sign_in] Enable FedCM for web. Use token expiration. (flutter#5225)
* Enables [**FedCM API**](https://developer.mozilla.org/en-US/docs/Web/API/FedCM_API) on compatible browsers.
* The GIS JS SDK falls-back to the JS implementation on browsers that don't support the new standard. See [migration instructions](https://developers.google.com/identity/gsi/web/guides/fedcm-migration)).
* Uses the supplied token expiration information to **more accurately compute `isSignedIn()` and `canAccessScopes(scopes)`**.
* This does not handle the case where users sign in/out in another tab or from outside the web app, that's still something that needs to be checked server-side.
* **Deprecates the `signIn()` method on the web.**
* Users should migrate to a combination of `renderButton()` and `silentSignIn()`, as described [here](https://pub.dev/packages/google_sign_in_web#migrating-to-v011-and-v012-google-identity-services).
### Issues
* FedCM:
* Fixes flutter#133703 (once rebuilt/redeployed)
* Fixes `b/301259123`
* Token expiration:
* Unblocks `b/245740319`
### Testing
* Added a few unit tests
* Manually verified token expiration: https://dit-gis-test.web.app1 parent 9f0e92f commit 33c2b4e
File tree
6 files changed
+139
-17
lines changed- packages/google_sign_in/google_sign_in_web
- example/integration_test
- src
- lib/src
6 files changed
+139
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
Lines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
58 | | - | |
59 | | - | |
| 63 | + | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
63 | 87 | | |
64 | 88 | | |
65 | 89 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 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 | + | |
88 | 112 | | |
89 | 113 | | |
90 | 114 | | |
| |||
Lines changed: 51 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| 109 | + | |
| 110 | + | |
105 | 111 | | |
106 | 112 | | |
107 | 113 | | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
111 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
112 | 121 | | |
113 | 122 | | |
114 | 123 | | |
| |||
230 | 239 | | |
231 | 240 | | |
232 | 241 | | |
| 242 | + | |
| 243 | + | |
233 | 244 | | |
234 | 245 | | |
235 | 246 | | |
| |||
238 | 249 | | |
239 | 250 | | |
240 | 251 | | |
| 252 | + | |
| 253 | + | |
241 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
242 | 261 | | |
243 | 262 | | |
244 | 263 | | |
| |||
265 | 284 | | |
266 | 285 | | |
267 | 286 | | |
| 287 | + | |
| 288 | + | |
268 | 289 | | |
269 | 290 | | |
270 | 291 | | |
| |||
302 | 323 | | |
303 | 324 | | |
304 | 325 | | |
305 | | - | |
| 326 | + | |
| 327 | + | |
306 | 328 | | |
307 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
308 | 347 | | |
309 | 348 | | |
310 | 349 | | |
| |||
338 | 377 | | |
339 | 378 | | |
340 | 379 | | |
341 | | - | |
342 | | - | |
| 380 | + | |
| 381 | + | |
343 | 382 | | |
344 | 383 | | |
345 | 384 | | |
346 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
347 | 389 | | |
348 | 390 | | |
349 | 391 | | |
| |||
368 | 410 | | |
369 | 411 | | |
370 | 412 | | |
| 413 | + | |
| 414 | + | |
371 | 415 | | |
372 | 416 | | |
373 | 417 | | |
| |||
379 | 423 | | |
380 | 424 | | |
381 | 425 | | |
| 426 | + | |
| 427 | + | |
382 | 428 | | |
383 | 429 | | |
Lines changed: 27 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
58 | 67 | | |
59 | 68 | | |
60 | 69 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 70 | + | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
77 | | - | |
| 83 | + | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
81 | 100 | | |
82 | 101 | | |
83 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
0 commit comments