Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • Sign in / Register
Minds Backend - Engine
Minds Backend - Engine
  • Project overview
  • Repository
  • Issues 272
  • Merge Requests 35
  • CI / CD
  • Security & Compliance
  • Packages
  • Analytics
  • Wiki
  • Snippets
  • Members
  • Collapse sidebar
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds Backend - EngineMinds Backend - Engine
  • Merge Requests
  • !443

Open
Opened 3 weeks ago by Ben Hayward@benhayward.ben
Report abuse

Oauth endpoint surge token deletion #1270

  • Overview 4
  • Commits 5
  • Pipelines 5
  • Changes 3

Summary

Old mr !436 (closed) Closes #1270

Currently on the mobile app if you log into one account, then log out and into a different account, you will still receive push notifications for the first account.

This is because the Surge tokens (used for push notifications) that we use on the backend are not deleted on logout.

Steps

Video https://streamable.com/979cr

This is not the most straightforward feature to test, you will need to be set up on postman, and need to use kubectl exec -it to check Cassandra on the review site.

  1. Open up Postman.
  2. Set up a set of environmental variables that point to this sandbox. For more information see here: https://developers.minds.com/docs/walk-throughs/postman/
  3. Navigate to POST v2 oauth token
  4. Send the request - it will return your token.
  5. COPY the token to a text editor, keep it handy.
  6. On postman head over to POST api v1 notifications.
  7. In the params, replace the token with your token. Hit send.

This should set the Surge token in Cassandra, so lets check.

  1. Get your user GUID (loading your channel on sandbox, watch the XHRs, filter channel, and get your GUID from the response)
  2. kubectl into the container
  3. Open cassandra (kubectl exec -it cassandra-0 cqlsh)
  4. Run select * from minds.entities where key='1017892315210977294' AND column1='surge_token';, replacing my GUID with your own.
  5. There should be a value for the surge token.
  6. Now go to DELETE v2 oauth token, click the Auth tab, and replace the bearer token with your own from your text editor.
  7. Hit send, it should return a 200 with no body
  8. Re-run the cassandra command. Surge token should be gone.

Regression Scope

Changes v Impact

  • Session\Manager - limited to the destroy functionality, so would affect anything that destroys a session (e.g. logging out).
  • Entities\User - added functions and an exported value, I don't foresee any issues here.
Edited 2 weeks ago by Ben Hayward
Request to merge fix/logout-surge-token-deletion-1270 into master
The source branch is 2 commits behind the target branch
Open in Web IDE
Pipeline #115366082 passed for a192e242 on fix/logout-surge-token-deletion-1270
          Merge request approved. Approved by
          Mark Harding Brian Hatchet
          Marcelo Rivera Rami Albatal Emiliano Balbuena Olivia Madrid Martin Santangelo
          Ready to be merged automatically. Ask someone with write access to this repository to merge this request

          Deletes source branch

          • Ben Hayward @benhayward.ben added Squad::Yellow Status::Requires Changes scoped labels 3 weeks ago

            added scoped labels

          • Ben Hayward @benhayward.ben added 1 commit 3 weeks ago

            added 1 commit

            • dd035afc - Update token.php

            Compare with previous version

          • Ben Hayward @benhayward.ben changed the description 2 weeks ago

            changed the description

          • Ben Hayward @benhayward.ben unmarked as a Work In Progress 2 weeks ago

            unmarked as a Work In Progress

          • Ben Hayward @benhayward.ben changed the description 2 weeks ago

            changed the description

          • Ben Hayward @benhayward.ben added 14 commits 2 weeks ago

            added 14 commits

            • dd035afc...be17eaf5 - 13 commits from branch master
            • aa7d6ff4 - Merge branch 'master' of gitlab.com:minds/engine into fix/logout-surge-token-deletion-1270

            Compare with previous version

          • Ben Hayward @benhayward.ben added 12 commits 1 week ago

            added 12 commits

            • aa7d6ff4...e4fdcb9e - 11 commits from branch master
            • 30a7116c - Merge branch 'master' of gitlab.com:minds/engine into fix/logout-surge-token-deletion-1270

            Compare with previous version

          • Ben Hayward @benhayward.ben added 10 commits 6 days ago

            added 10 commits

            • 30a7116c...5e9b7bb9 - 9 commits from branch master
            • a192e242 - Merge branch 'master' of gitlab.com:minds/engine into fix/logout-surge-token-deletion-1270

            Compare with previous version

          • Ben Hayward
            Ben Hayward @benhayward.ben · 5 days ago
            Developer

            The issue seems to be that the notification endpoint is not running in full. That endpoint is not touched in this fix. Can prove it works by skipping steps 6 and 7 and instead running

            UPDATE minds.entities SET value = '123123' where key='{{ your guid }}' and column1='surge_token';,

          • Brian Hatchet
            Brian Hatchet :speech_balloon: @brianhatchet · 1 day ago
            Developer

            Let's make sure that it's not because we're revoking the surge tokens before we save the user. User calls ElggUser's save with then fires off a create event, so we have a couple of write operations which could be firing out of order and causing the not writing on review sites.

          • Brian Hatchet :speech_balloon: @brianhatchet approved this merge request 1 day ago

            approved this merge request

          • Mark Harding @markeharding approved this merge request 1 day ago

            approved this merge request

          • Brian Hatchet :speech_balloon: @brianhatchet added Status::Ready to Merge scoped label and automatically removed Status::Requires Changes label 1 day ago

            added scoped label and automatically removed label

          • Ben Hayward
            Ben Hayward @benhayward.ben · 1 day ago
            Developer

            Note about possible caching conflicts on the POST request that could be causing an issue.

            Plan - check on staging that it works.

          • Xander Miller
            Xander Miller @xander-miller · 27 minutes ago
            Developer

            guid: "1025784527299022860"

          Please register or sign in to reply
          0 Assignees
          None
          None
          Milestone
          None
          Time tracking
          No estimate or time spent
          2
          Labels
          Squad::Yellow Status::Ready to Merge
          Lock merge request
          Unlocked
          9
          9 participants
          user avatar
          user avatar
          user avatar
          user avatar
          user avatar
          user avatar
          user avatar
          Reference: minds/engine!443