``` mermaid sequenceDiagram actor u as authenticated user participant w as fuel-web participant c as fuel-core participant d as discord participant db as discord-bot participant a as bc-aggregator u->>+w: after claim w ->>+c: /users/account c ->>-w: account_data w ->>w: check if the user has discord_name already w ->>+d: if no: start discord oauth challenge d ->>d: consent happens d ->>+w: finish discord oauth challenge w ->>+d: get discord user_data d ->>-w: discord user_data w ->>+c: send encypted discord_name c ->>c: decrypt and save c ->>-w: 200 u ->>+d: join channel d ->>+db: join event db->>+c: owns_token(user, server)? c->>-a: have token? a->>+c: yes c->>-db: grant(None | RoleName) c->>c: job: check ownership (30min) c->>a: all users still have token? a->>c: no c->>db: revoke role ``` # Endpoint Core GET `api.onfuel.io/discord/shouldGrantRole` Params: - `${username}#${discriminator}` - guild (server name) Response: - `None | grant<rolename>`o ``` u->>+w: opens the claim page w ->>+c: get redirect oauth url c ->>+w: return oauth_url w ->>+d: redirect to consent d ->>+w: redirect to the cb url w ->>+c: forwards payload to cb url c ->>+c: adds a discord user_name to the users table c ->>+w: 200 / 403 w ->>-u: 200 / 403 u ->>+d: join channel d ->>+db: join event db->>+c: owns_token(user, server)? c->>-a: have token? a->>+c: yes c->>-db: grant(None | RoleName) c->>c: job: check ownership (30min) c->>a: all users still have token? a->>c: no c->>db: revoce role ```