Commit 1bddc42
authored
fix: fix OIDC acceptance from preview sharing links (#4759)
## Context
- alice.twake.app shares a folder with bob.twake.app
- recipient instance: not known yet and Alice share by email
[[bob@example.com](mailto:bob@example.com)](mailto:bob@example.com)
- Bob member exists in Alice’s sharing document `email =
bob@example.com, instance = "", status = pending`
- Bob also has a sharing credential state, for example:
`credentials[0].state = abc123`
- And preview permission exists `sharecode = 123` mapped to Bob
- Bob receives/open this preview link
[https://alice-drive.twake.app/preview?sharecode=](https://alice-drive.twake.app/preview?sharecode=lgGAegWLpvqk)123
- Important: this URL contains sharecode, not state.
- Bob Opens The Link
- Bob lands on Alice’s Drive preview page.
- The stack can identify Bob at this point because it has sharecode =
123
- Internally this works: sharecode -> preview permission ->
[[bob@example.com](mailto:bob@example.com)](mailto:bob@example.com) ->
Bob member, so Bob is not missing yet.
- Bob Clicks “Synchronize With My Twake”
- The UI sends Bob to Alice’s sharing discovery page, still based on the
preview link/sharecode flow.
- Sharecode -> Bob member -> Bob credential state abc123, but before the
fix, the discovery page did not do that conversion, it renders OIDC
button with
https://alice.twake.app/oidc/sharing?sharingID=SHARING_ID&state=
- Bob Clicks “Log In With OIDC” on the button without sharing state
## Fix
When discovery receives a valid `sharecode`, resolve the member from
that sharecode and derive the member credential `state` before rendering
the page. This keeps the existing OIDC sharing flow unchanged while
making preview links provide the state expected by the OIDC callback.2 files changed
Lines changed: 87 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
689 | 703 | | |
690 | 704 | | |
691 | 705 | | |
| |||
774 | 788 | | |
775 | 789 | | |
776 | 790 | | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
777 | 805 | | |
778 | 806 | | |
779 | 807 | | |
| |||
785 | 813 | | |
786 | 814 | | |
787 | 815 | | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
796 | | - | |
797 | | - | |
798 | | - | |
| 816 | + | |
799 | 817 | | |
800 | 818 | | |
801 | 819 | | |
| |||
806 | 824 | | |
807 | 825 | | |
808 | 826 | | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
| 827 | + | |
820 | 828 | | |
821 | 829 | | |
822 | 830 | | |
823 | 831 | | |
824 | 832 | | |
825 | 833 | | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
826 | 837 | | |
827 | 838 | | |
828 | 839 | | |
| |||
886 | 897 | | |
887 | 898 | | |
888 | 899 | | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
889 | 903 | | |
890 | 904 | | |
891 | 905 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
431 | 482 | | |
432 | 483 | | |
433 | 484 | | |
| |||
0 commit comments