Oversee various interactions for the user

I am currently utilizing NodeJs, ExpressJs, and Angular 6 for my application, but I have encountered an issue.

Within my system, there is a user with the attributes:

User U:
{
    name;
    email;
    password;
}

Let's assume this user, named U, is logged in simultaneously from Chrome, Firefox, and a Mobile Phone. If U decides to change their name using the mobile phone, I need to update it in the database and ensure that all signed tokens across all devices reflect this new name.

What would be the most efficient approach to handle this scenario?

I would appreciate any alternative suggestions as well.

Thank you.

Answer №1

In essence, the typical response is essentially "you can't". I would also make a case for why "you shouldn't."

When you modify any part of the payload, existing tokens will become invalid because the payload is included in what is authenticated for verification purposes. This plays a critical role in ensuring that the tokens remain untampered with.

As a result, all tokens across all devices are likely to be rendered invalid, requiring the user to log in again on each device to obtain a new token. The way you currently manage a logged-out user in your application is the right approach to handling this situation.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Attempting to sort data with AngularJS

I'm currently working on implementing 'order by' functionality in my Angular app. Here's what I've attempted: <div *ngFor = "let movie of webService.movie_list | async | orderBy:'Year'"> However, when testing it ...

Having issues with node-inspector on a Linux server

My Linux server (Ubuntu 12.04) is set up with nodejs and node-inspector for debugging, but I'm having trouble accessing the debugger from a Windows machine on the same network. Here's what I've done so far: I downloaded the latest stable ...

Issue with holding session in Mongoose-Auth/Express/Connect not being resolved

Currently, I am in the process of developing a node js app and attempting to implement a user authentication system using Mongoose-Auth. Despite following several tutorials and guides on how to use Mongoose-Auth, I have encountered a hurdle. The basic pas ...

How can we effectively make a call to another API using the Refresh Token within an Angular Interceptor?

I needed to refresh the access token before sending an API request. The new token will be added to the previous API call within the interceptor. How can I trigger another API call in an Angular interceptor? import { Injectable } from '@angular/core&ap ...

When using Node Puppeteer, if the page.on( "request" ) event is triggered, it will throw an error message stating "Request is already being handled!"

I am currently utilizing puppeteer-extra in conjunction with node.js to navigate through multiple URLs. During each iteration, I am attempting to intercept certain types of resources to load and encountering the error below. PS C:\Users\someuser ...

Tips on continuously making calls to a backend API until receiving a successful response with status code 200

While working on my Angular project, I have encountered a situation where I need to make calls to a backend API. If the response is not 200 OK, I have to keep calling the API every 30 seconds until I receive a successful response. In Angular, I usually ca ...

This code snippet, document.location.search.replace('?redirect=', '').replace('%2F', ''), is failing to execute properly in Firefox

The functionality of document location search replace redirect to another page works in Chrome, however, document.location.search.replace('?redirect=', '').replace('%2F', ''); it does not work in Firefox; instead, ...

Is there a way to determine the distance in miles and feet between various sets of latitude and longitude coordinates?

I am working with an array of latitude and longitude coordinates and I am looking to use JavaScript or Typescript to calculate the distance in miles and feet between these points. const latsLngs = [ { lat: 40.78340415946297, lng: -73.971427388 ...

Disguising the Navigation Bar when choosing from various databases

I am currently facing the following issue: <div class="container"> <h3 class="d-flex justify-content-center">Database</h3> <div class="row"> <div class="col-xs-12"> < ...

Tips for embedding a YouTube video using dynamic source variables on an iframe

Here is a sample code snippet showing how to implement a YouTube iframe by passing the src variable <div class="container"> <div class="container-videos"> <div class="row"> <div cla ...

Accessing an element by its ID with the help of a looping

Looking to retrieve a string from my database and insert it into my paragraphs: <p id="q_1"></p> <p id="q_2"></p> The following code works correctly: $.get("bewertung/get/1", function (data) { document.getElementById("q_1") ...

Generate a fresh array by appending a JSON element and inserting a new attribute into the same JSON object that was appended

I have a JSON array and I am looking to create a new array where I can push all childNodes along with their respective funding source names. var data = vardata={ "costdata": [ { fundingSource: 'A', childNode: [ ...

Sending parameters in GraphQL with Typescript results in an empty set of curly braces being returned

I am new to learning GraphQL with Typescript and I am trying to pass an argument in a GraphQL function to return something dynamically. I have been struggling with this issue for the past hour and could not find any solutions. Here are the relevant code sn ...

Exploring the world of child routing in Angular 17

I've been experimenting with child routing in Angular and encountered some confusion. Can someone explain the difference between the following two routing configurations? {path:'products',component:ProductsComponent,children:[{path:'de ...

Opening a new tab in Angular 6 from a component with freshly generated HTML (containing input data)

Hello everyone. I have a requirement where I need to open a new browser tab with formatted input data from a modal component. Here's an example code snippet that attempts to achieve this using ng-template: @Component({ template: '< ...

Using two Mongoose collections on a single webpage with Express

There is an issue with my Express route that fetches data from two separate MongoDB collections. One collection displays the results correctly, but the other does not (I have defined schemas for both). router.get('/demo/:cars_getroute', (req, re ...

Accessing Next and Previous Elements Dynamically in TypeScript from a Dictionary or Array

I am new to Angular and currently working on an Angular 5 application. I have a task that involves retrieving the next or previous item from a dictionary (model) for navigation purposes. After researching several articles, I have devised the following solu ...

Refreshing the webpage upon submitting with Angular2 and Firebase technology

Yesterday, I came across an Admin HTML template that I wanted to integrate with Firebase. However, when I tried to register and clicked on Sign in, the page would reload instead of carrying out the Firebase createUserWithEmailAndPass process. Here is a s ...

Issues with npm dependencies bundling not functioning properly

I am currently utilizing node version 14 along with npm version 6, which should provide support for the bundledDependencies feature. My objective is to set up the following structure: package-C is a bundled dependency of package-B package-B is a dependen ...

Route all Express JS paths to a static maintenance page

Need help with setting up a static Under construction page for an Angular Web App with Express Node JS Backend. I have a function called initStaticPages that initializes all routes and have added a new Page served via /maintenance. However, when trying to ...