Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've looked through the package's code, and cannot seem to piece together what is needed to do this.
If I have the IMember object, how does one programmatically log the member in so that all downstream code and pages carry the authenticated member?
You use the MembershipHelper to log in a member, passing it the username and password of the member logging in.
I dont have the username and password.
So how do you know they are a valid member?
You need to write a formsauthentication cookie, but you will still need a username to do that, so you will need to get that using your imember object
Check https://github.com/Shazwazza/UmbracoIdentity/blob/e5af79578de92aa335ba5dbfb594ba9f6ad9173e/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs#L74 , loginInfo contains the username.
Depending on the type of external authentication, the username can be returned in loginInfo.DefaultUserName or in loginInfo.Login.ProviderKey
We do this:
string username = string.Empty;
username = loginInfo.DefaultUserName;
else if (!string.IsNullOrEmpty(loginInfo.Login.ProviderKey))
username = loginInfo.Login.ProviderKey;
//find member by username
var member = await UserManager.FindByNameAsync(username);
if (member != null && Services.MemberService.GetById(member.Id).IsApproved)
await SignInAsync(member, isPersistent: false);
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted