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
Hana Aanaa
NA
38
619
How to store cookies in Asp.Net Identity for webApi
Apr 15 2019 9:29 AM
Hello all,
I have Asp.net web Application project with WebApi and individuals user Account. I implemented Registration and login, and I used angularjs in front end.
Now, I need to store cookies in browser.
I'm confused if authentication based on cookies store cookies in browser?
In my project I authenticate users based on token.
I do research but it confuse me and I did't find a clear guide to store cookies using Asp.Net Identity webApi?
Also, I don't understand if I need to use claims?
This is the mothed for check user authentication:
public
override
async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
var userManager = context.OwinContext.GetUserManager<ApplicationUserManager>();
ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password);
if
(user ==
null
)
{
context.SetError(
"invalid_grant"
,
"The user name or password is incorrect."
);
return
;
}
ClaimsIdentity oAuthIdentity = await user.GenerateUserIdentityAsync(userManager);
ClaimsIdentity cookiesIdentity = await user.GenerateUserIdentityAsync(userManager);
AuthenticationProperties properties = CreateProperties(user.UserName);
AuthenticationTicket ticket =
new
AuthenticationTicket(oAuthIdentity, properties);
context.Validated(ticket);
context.Request.Context.Authentication.SignIn(cookiesIdentity);
}
Reply
Answers (
1
)
Scan Image In Asp.net
website count all words and site link in asp.net Mvc