Error from to code alternate using server?

Dutch :

I am pretty new to C#, I am very used to python. So what I am trying to do is hard for me to figure out.

Basically I am reading a JWT from a server, and I want to put that information from it into an object.

var handler = new JwtSecurityTokenHandler();
var token = handler.ReadJwtToken(jwtObj.accessToken);

I then run it through a serializer function I found:

var x = JsonConvert.SerializeObject(token.Claims.Select(c => new { c.Type, c.Value }))

which gives an object like

[ { "Type": "firstName", "Value": "Jim"}, {"Type": "lastName": "Halpert" } ... ]

But my object i want has attributes firstName and lastName. This seems very simple, but I cannot for the life of me figure out how to get it in the object. I have tried various methods but just assume that I ended here.

any idea what I can do?

user13582267 :

Simple. token.Claims.ToDictionary(c => c.Type, c => c.Value)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Select alternate rows from SQL Server table

php code to generate alternate no from for loop

generic code to reverse alternate words in a sentence using python

Alternate way of returning data from fetch using useEffect inside a callback

how to select alternate rows from mysql using php

Router Access Control List to prevent users from using alternate DNS

Pass the error Message to XPage client from Java Server code

Ionic FileTransfer from camera Error Code : 3 to server hosting

Alternate of offset in sql server

Alternate of Except in SQL Server

Alternate for %TYPE in SQL Server

Understanding factorials and alternate code

Web Application using a library shows We're sorry, a server error occurred while reading from storage. Error code NOT_FOUND to some users

retrieving images from server using ajax, jQuery. code not working

Values getting null at server code from ajax call using Angularjs

Delete using alternate key

Error when download a file from server using scp

Getting invalid column error from SQL Server while using a view

Getting error from server using nexmo npm package to send SMS

Android: How handle message error from the server using Volley?

How to read the JSON Error response returned from Server using Libcurl

vector initialization, getting an error using code from C++ book

Error in the code while trying to read from URL using XML, xmlParse

Error fetching source code from web page using eclipse

Trying to connect to twisted Server using sample code echoserver.py from twisted book. Getting error can't listen to multiple address

"Out of memory exception" error for which part of the code in C#? Any other alternate way?

We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED

Error: (jupyter server crashed. Unable to connect. Error code from jupyter: 1)

Error: Response from server: Error Code: 20 - Authentication failure - Amazon Managed Blockchain