twitterservicestackservicestack-auth

ServiceStack Twitter Auth and Registration


I've got an app that has been running using CredentialsAuthProvider() for a while.

Today, I'd like to add twitter and facebook as options for people to create an account. I've got the scaffolding in place.

  //Register all Authentication methods you want to enable for this web app.            
  Plugins.Add(new AuthFeature(() => new AuthUserSession(),
    new IAuthProvider[] {
      new CredentialsAuthProvider(),
      new TwitterAuthProvider(appSettings),
      new FacebookAuthProvider(appSettings)
  }));


  //Provide service for new users to register so they can login with supplied credentials.
  Plugins.Add(new CustomRegistrationFeature());

The endpoints /api/auth/twitter and /api/auth/facebook work, and I see that a user session is created by visiting /api/auth once the OAuth process is complete HOWEVER...

No user is created in my UserAuthRepository (OrmLiteAuthRepository). The User Id stored in the session is invalid. Any method decorated with the [Authenticate] attribute causes a 404 (User not found) error to be returned.

I would expect that a user is created with the First/Last/Email obtained from Facebook or Twitter. Am I misunderstanding something?

ServiceStack v4.0.38


Solution

  • I wanted to update this thread to say that I've upgraded to ServiceStack 4.0.42 and this issue has resolved itself.