New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the Community Exchange, where community members ask and answer questions about DNN. To get started, just start typing your question below and either select one of the suggested questions or ask a new question of your own.

single sign on

Return to previous page

  • 11/6/2013
  • 3579 Views

Question:

Web Services long time ago
I'm trying to log a user into a dnn site from a third party application. The idea is, they login to my custom app, I check that username and password against what DNN has (already have that working) and then I log them into both my site and the dnn site.

I have a web service set up right now that does log the user in if you browse to it. Like mydnnsite.com/myservice/login?un=user&pw=password

However, if I just call that as a web request from my third party site, it does not log the user in. I'm assuming it's because a cookie isn't getting set when I don't actually browse to the site. Any ideas on how I can accomplish this? Here is my login web service script as of right now

//create the status object
DotNetNuke.Security.Membership.UserLoginStatus status = new DotNetNuke.Security.Membership.UserLoginStatus();

//set it to fail
status = UserLoginStatus.LOGIN_FAILURE;

//see if they are a valid user
var obj = UserController.ValidateUser(0, username, password, "DNN", PortalSettings.PortalName, hostIp, ref status);

if (status == UserLoginStatus.LOGIN_SUCCESS || status == UserLoginStatus.LOGIN_SUPERUSER)
{
//if they are, log them in and return true
UserController.UserLogin(0, obj, PortalSettings.PortalName, hostIp, false);

DotNetNuke.Services.Authentication.UserAuthenticatedEventArgs eventArgs = new DotNetNuke.Services.Authentication.UserAuthenticatedEventArgs(obj, username, status, "DNN");
eventArgs.Authenticated = true;
System.Web.Security.FormsAuthentication.SetAuthCookie(username, true);
return "true";
}
else
{
return "false";
}

single sign on

Web Services
Web Services long time ago
Add an Answer

Answers

Sign In to Participate
Or register to become a member