oidc-client-js failing to display all profile claims that are supported by oidc-client-js

When setting up UserManager on the oidc-client-ts TypeScript module using the config object below:

  var config = {
    authority: "https://localhost:3000",
    client_id: "js",
    redirect_uri: "https://localhost:3001/callback.html",
    response_type: "code",
    scope: "openid profile IdentityServerApi colour", 
    post_logout_redirect_uri: "https://localhost:3001/index.html",
  }

The usermanager.getUser function returns a user object with specific profile claims:

  {
    "iss": "https://localhost:3000",
    "iat": 1681658331,
    "exp": 1681658631,
    "aud": "js",
    "sid": "E5E4621779C8970433CEE2E6472FF8DE",
    "sub": "cc23a1a1-a8ff-4caf-8fef-555d98923b8a",
    "idp": "local"
  }

However, when using the same config with oidc-client-js, the profile object returned is different:

  {
    "amr": [
      "pwd"
    ],
    "sid": "32A90BF8B0EBF7780BC9B8E0AD3DDE8B",
    "sub": "cc23a1a1-a8ff-4caf-8fef-555d98923b8a",
    "auth_time": 1681659272,
    "idp": "local",
    "name": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fe8a969b9f9a939790be9b939f9792d09d9193">[email protected]</a>",
    "preferred_username": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bdc9d5d8dcd9d0d4d3fdd8d0dcd4d193ded2d0">[email protected]</a>",
    "favorite_colour": "FAVORITECOLOUR_DEFAULT"
  }

I have attempted to update the config with additional values as suggested by the documentation, but they do not seem to affect the results being returned:

  {
    ...
    client_authentication: "client_secret_post",
    loadUserInfo: true,
    mergeClaims: true,
    filterProtocolClaims: false
  }

There seems to be an issue with the number of times userClaims are requested during login. The ts module requests them twice, while the js module requests them three times.

Could this issue be related to the configuration used for setting up the UserManager or the redirection process?

Here is the config used for UserManager on the client callback page:

  {
    authority: "https://localhost:3000", 
    response_mode: "query", 
    client_id: "js",
    redirect_uri: "https://localhost:3001/callback.html",
  }

I may not fully understand oAuth, but I am puzzled by the discrepancies in profile data between the two versions despite identical configurations.

Answer №1

After spending some time writing down this question, I was able to find the solution myself.

I realized that it was necessary to add 'loaduserinfo' to the 'usermanagerSettings' configuration object on the callback page:

  {
    ....
    loadUserInfo: true,
  })

I will leave this question here in case someone else runs into the same issue. It took some effort to finally solve it.

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

Desktop display issue: Fontawesome icon not appearing

Having trouble getting the fontawesome icon to display properly on my website. It appears in inspect mode, but not on the actual site itself. Any suggestions on how to fix this issue? import React, { Fragment, useState} from "react"; import { Na ...

Steps for incorporating the getElementByClassName() method

I have developed an application that features a list displayed as shown below: https://i.stack.imgur.com/BxWF2.png Upon clicking each tick mark, the corresponding Book name is added to a textbox below. I desire the tick mark to be replaced by a cross sym ...

What could be causing my div to not appear when using jquery's show function?

I'm dealing with HTML code that looks like this: <div id="answerTypeSection" style="visibility: hidden"> <div class="row"> <div class="col-md-2">adfadfafasdfasdfas</div> </div> <label class="control-label"&g ...

The equation of jquery plus ie7 results in an undefined value

I am experiencing a strange issue in IE7 with a jQuery script. This problem seems to only occur in IE7. In summary, when I check the console window, it shows that jQuery is not defined - even though I have loaded jQuery (version 1.7.1) from my disk and can ...

How to read a text file in JavaScript line by line

Coding Challenge: <script src="../scripts/jquery-3.1.0.min.js"></script> <script> $(document).ready(function(){ $('#test').click(function(){ var txtFile = '../data/mail.txt'; var file ...

What measures can be taken to prohibit a user from accessing a client-side HTML file using express?

I am currently developing a task management application called "todolist." In my node.js code, I utilize express and grant it access to my directory named Client: var app = express(); app.use(express.static(__dirname + "/Client")); The contents of my Cl ...

What is preventing me from accessing the sub-elements of an AngularJS controller?

I know this question has probably been asked countless times before, but I'm struggling to find the right words to explain my specific issue. Essentially, I'm having trouble accessing something like $ctrl.thing.subelement. However, the following ...

The Stripe payment form effortlessly updates in real-time thanks to the powerful @stripe/react-stripejs module

I am experiencing some difficulties with implementing Stripe payment in my Medusa-JS Next JS frontend. Whenever I enter card details in the checkoutForm, the entire StripePayment component keeps re-rendering every time I click on anything within the form ...

Navigating between interfaces without the need to constantly refresh or reload

Currently, I am in the process of developing a website using ASP.NET MVC that allows users to navigate between pages without refreshing each time. My approach involves treating views as 'areas' or mini master pages, utilizing partial views inste ...

Angular 2 Express failing to trigger ngOnInit method

I'm having some trouble with Angular services. I used the default code from "Angular.io" to make service calls, but for some reason the ngOninit method isn't getting called. I've implemented the component from OnInit and added @Injectable to ...

Having trouble capturing the 'notificationclick' event in the service worker when using Firebase messaging with Nuxt.js and Vue.js?

Experiencing difficulties in detecting events other than install, activate, or push in my firebase-messaging-sw.js. Notifications are being received and displayed, but I am unable to detect the event handler for notificationclick. When a firebase notificat ...

Webpack 5 is failing to bundle re-exports correctly

Whilst bundling my web application, I've come across an issue with re-exports of certain modules not behaving as expected. Despite trying various optimization settings, I have been unsuccessful in resolving this issue. Setup Here's the setup tha ...

Attempting to deploy my initial Google Cloud Function, encountering an error message indicating that Express is not detected

Currently in the process of deploying my first Google Cloud function, the code for which can be found here: https://github.com/rldaulton/GCF-Stripe/blob/master/Charge%20Customer/index.js The code starts with the following line: var app = require('e ...

Using Mongoose to delete multiple documents with the "like" operator

I am looking to remove all documents from a MongoDB collection that have a particular string in one of the fields. (I am working with mongoose) In SQL terms, the equivalent query would be: DELETE FROM users WHERE name LIKE '%test%' ...

Stop zombie.js from loading exclusively third-party resources

During a test, I am using zombie.js to load a page from a local express server. However, the page contains a script element that makes a call to Google Analytics. I want to prevent this external script from loading while allowing other local scripts to run ...

In Firefox, long strings are automatically truncated, while in Google Chrome they display perfectly without any truncation

Here is a block of code where I am using a web service to retrieve a JSON string. It is encapsulated in an XML tag, which I then read and parse with jQuery's parser jQuery.parseJSON(xml.getElementsByTagName("string")[0].firstChild.nodeValue); $.ajax ...

Running a Playwright test without relying on the command line

Is it possible to automate running a playwright test without having to manually input npx playwright test in the command line every time? I am looking for a way to initiate a playwright file from another file and have it execute without the need for acce ...

Encountering an unforeseen change in the "buttonText" attribute

I've developed a simple Vue.js component for a button. When the button is clicked, it should display the text "I have been clicked." It does work as expected, but I'm also encountering an error that reads: 49:7 error Unexpected mutation of "but ...

Encountering NaN values in JavaScript arrays

I'm facing an issue with my HTML code that is supposed to make ball(s) bounce around the canvas. However, when I set the arrays storing the coordinates to random positions and test with alert("Co-ordinates " + (cirX[i]) + " x " + (cirY[i]));, it retur ...

Tips for sharing JSON data between JavaScript files

Here is the initial script setup to utilize static .json files for displaying and animating specific content. The code provided is as follows: var self = this; $.getJSON('data/post_'+ index +'.json', function(d){ self.postCa ...