I am using Web Forms Template in VS2012 and looking at OpenAuth code.
I wish to store some external data after a successful external login, but during debug cannot see how to get hold of the logged in username during the code execution at these points after a valid external login –
ProcessProviderResult
– if (OpenAuth.Login(authResult.Provider, authResult.ProviderUserId, createPersistentCookie: false))
CreateAndLoginUser()
– if (OpenAuth.Login(ProviderName, ProviderUserId, createPersistentCookie: false))
After these calls there is no User.Identity.Name and the username has not been authenticated, so how can I get the membershipusername?
It seems to be logged in after the redirect (do I really have to store something in a session and munge it in after redirect? I think I am doing it wrong).
What methods on OpenAuth.?? or equivalent do I need to call to get the username so I can then store my data as required.
Thanks
User.Identity.Namewill only be filled by the Forms Auth authentication provider on return (after the client has been redirected, as you point out).But during the auth process, in the OpenAuth code before the redirect, the user name is simply represented by
AuthenticationResult.UserName(ie: authResult.UserName in ExternalLoginLandingPage.aspx.cs).