Niels Heisterkamp
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Social Login Over The Line === Goal: Social login should run on feature branch without bugs ## [[MACC-12846]](https://jira.grandvision.global/browse/MACC-12846) [BE] Update backend to only merge 2 accounts (and not more) Currently we have 2 use-cases for merge accounts. 1. merge account one by one from my-settings (outside of mvp) 2. merge accounts (plural) from following use-case - user creates account with email - user does Social login with Google - user clicks: Don't merge - user does Social login with Apple - user clicks: Yes merge (all my accounts) The second implementation is more difficult / tricky to implement. **Problems** - problem 1: auth0 does not have atomic merge multiple accounts feature - therefore accounts can be partially merged - current implementation does not account for this - problem 2: What do we do with a message on the bus that states merge 2 secondary accounts with 1 primary - if one secondary account fails to link, we only have 1 message on DLQ - also retries can create new issues (Potential design issue is having 2 id's in 1 message.) ## Solution ### Proposed solution from 18 jan. This has been discussed with Technical Architect. Proposed solution is to only allow for the first use-case (merge accounts one-by-one). This requires us to change the GraphQL schema a bit. From account `[ID]` to `ID` in some cases. Also the event currently contains a list of account id's to merge instead of only one secondary id. ### Counter proposal For every account that can be merged we publish 1 event to the bus. For every merge request that goes wrong we put the message in the DLQ. This way we solve problem 1 and problem 2 and be able to merge all the accounts. This solves the following issue: - Merge A & B - A succeeds - B fails -> message fails - Message is retried - A does not exist -> message fails, repeating Pro: - no FE change needed Note; Message model still needs to be changed and `linkAccounts` too. Resolver / provider of the FE mutation also needs to be changed to send 2 events instead of one. ## Schema ### Current FE graph ```graphql type Mutation { # Initializes the social login flow initializeSocialLogin(input: InitializeSocialLoginInput!): InitializeSocialLoginResult! # Will fetch accounts with the same identity and propose accounts that can be merged if applicable completeSocialLogin: CompleteSocialLoginResult! @auth(roles: ["customer"], permissions: ["update:customer"]) # Will initiate the account merge socialLoginMerge: SocialLoginMergeResult! @auth(roles: ["customer"], permissions: ["update:customer"]) } ``` ### Current BE graph ```graphql type Mutation { # link user accounts linkAccounts(input: LinkAccountsInput!): LinkAccountsResult! @auth(roles: ["machine-internal"], permissions: ["update:customer"]) } input LinkAccountsInput { primaryAccountId: ID! toMergeAccountsIds: [ID!]! } type LinkAccountsResult { linkedIds: [ID!]! # Problem: is we don't support arrays, also naming failures: [LinkAccountsFailure!]! } type LinkAccountFailure implements Failure { message: String! } union LinkAccountsFailure = LinkAccountFailure ``` ### Proposed BE graph change ```graphql input LinkAccountsInput { primaryAccountId: ID! secondaryAccountId: ID! } type LinkAccountsResult { linkedId: ID! # or `success: Boolean!` failures: [LinkAccountsFailure!]! } ``` Or preferably without the indirection through ASB/functions. Function app can imo exist as input for other systems, no use to go from customer-service -> calm-functions -> customer-service. ```plantuml CS --|> ASB ASB --|> CALM CALM --|> CS ``` ## [[MACC-12608]](https://jira.grandvision.global/browse/MACC-12608) [FE + BE] Social login - add consent to merge to primary account With changes to multiple messages on ASB the current implementation of updating consents has a possible race condition. ```plantuml "customer-service (google)" ->> auth0 : get_consents (A) auth0 ->> "customer-service (google)" : get_consents (A) "customer-service (apple)" ->> auth0 : get_consents (A) auth0 ->> "customer-service (apple)" : get_consents (A) "customer-service (google)" ->> auth0 : write_consents (A + consents google = B) "customer-service (apple)" ->> auth0 : write_consents (A + consents apple = C) ``` In this situation the google account merge consent will be overwritten by the apple account merge consent. To mitigate this issue we will move the writing of consents to the mutation where the merge request is started. Semantically this also makes more sense, because the consent is given before the actual merge is performed. ## To Do ### What we need to do to finish anyway - [x] unit tests - [x] move AccountService initialisation - [ ] component tests - [x] Customer-service: move customer repository ### Related to [[MACC-12846]](https://jira.grandvision.global/browse/MACC-12846) [BE] Update backend to only merge 2 accounts (and not more) - [x] Merging of all accounts vs merging 1 account at the time - [x] customer-service: remove initializeSocialLogin mutation (what/why???) - [x] customer service schema.graphql aanpassen - [x] event model aanpassen secondary is ID ipv [ID] - [ ] UX/Design aanhaken - from a Design / UX perspective is it better to merge multiple accounts or only one - [x] TA @Anarag aanhaken, akkoord op schema changes #### Changes to make - [ ] Save consents before sending messages - [ ] ~~Post multiple messages on bus to merge accounts one by one~~ - [x] Add mutation to merge a single pair of accounts from FE (just put one message on the bus) ### Related to [[MACC-12608]](https://jira.grandvision.global/browse/MACC-12608) [FE + BE] - Social login - add consent to merge to primary account - [ ] move consents saving to before putting messages on bus - [ ] consents issue merged to FB

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully