SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently have an MVC website that uses forms authentication using the default SqlMembershipProvider.

In this website I can automatically log a user in by simply having a GUID that corresponds to their UserId in the aspnet_Membership table. All I do is query the table, then using their username I simply have forms authentication set the auth cookie.

I currently use:

FormsAuthentication.RedirectFromLoginPage(username, false)

But can optionally also use:

FormsAuthentication.SetAuthCookie(username, false, "/")

Now, I need to do something similar to this, but on SharePoint. SP does have access to my membership tables.

However, it seems that SP uses SecurityTokens for the validation:

        SecurityToken token = SPSecurityContext.SecurityTokenForFormsAuthentication(new Uri(SPContext.Current.Web.Url), formsClaimsAuthenticationProvider.MembershipProvider, formsClaimsAuthenticationProvider.RoleProvider, strUsername, strPassword);   

        if (null != token)   


  1. Is there a way to get this token by simply providing the username, without the password?
  2. Or, can I manually create the SecurityToken to provide to SetPrincipalAndWriteSessionToken()?
  3. Or, can I manually set the authentication cookies myself?
share|improve this question

Since its forms authentication,

configure it with your existing membership database.

Have a custom login form where you can have user ID alone & follow the below article to proceed further:


share|improve this answer

It is Forms Authentication and readily supports extension. Simply write a custom membership provider (or even use your current provider) and wire it into SharePoint

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.