TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
278.5k
How to return access token as json result ?
Sep 7 2019 9:09 AM
Problem
How to return Access Token as json result ?
I work on asp.net core 2.2 from function below i generate access token
it is success generated as string but i need to generated as json
How to generate access token as json from function below ?
public
string
GenerateTokens(
string
userId)
{
var Claims =
new
Claim[]
{
new
Claim(JwtRegisteredClaimNames.Sub,userId)
};
var signingkey =
new
SymmetricSecurityKey(Encoding.UTF8.GetBytes(
"this is secret phrase"
));
var SigningCredntials =
new
SigningCredentials(signingkey,
SecurityAlgorithms.HmacSha256);
var Jwt =
new
JwtSecurityToken();
var jsonu =
new
{ id = userId };
Jwt.Payload[
"user"
] = jsonu;
return
new
JwtSecurityTokenHandler().WriteToken(Jwt);
}
Reply
Answers (
5
)
convert gridview data into pdf according to selected date
how to add a complete form dynamically on add more button