• Mr. Beginner
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hi All,

 

I have created my first web-service which is supposed to check whether username/password are valid for customer portal user. No redirections are needed, just return something according the result. Here's my code:

 

 

webservice  static Auth validateLogin(String username, String password){
       
       Auth a = new Auth();
 
        String startUrl = 'https://emea.salesforce.com/secur/login_portal.jsp';
         
               startUrl += '?orgId=XXXXX&portalId=YYYYY&loginType=3';
               startUrl += '&startUrl=';
               startUrl += '&loginUrl=';
               startUrl += '&useSecure=true';
               startUrl += '&un=' + username;
               startUrl += '&pw='+ password;

     PageReference p = Site.login(username, password, startUrl);
      
      if (p == null){
          
          a.result = username+password+startUrl;
      }
      else{
          
          a.result = password+username;
      }
       return a;
       
   }

 

 

 

I can login to my portal from the link in the startURL if I input it in my browser and use the 'normal' way, but somehow my pageReference p is always NULL. The object gets returned to my php code and I have double checked all my strings like 1000 times. Why does it let me in using the normal login form, but not with a webservice? Is it the path of startUrl?

 

Do you guys have any direction for me?

Hi All,

 

I have created my first web-service which is supposed to check whether username/password are valid for customer portal user. No redirections are needed, just return something according the result. Here's my code:

 

 

webservice  static Auth validateLogin(String username, String password){
       
       Auth a = new Auth();
 
        String startUrl = 'https://emea.salesforce.com/secur/login_portal.jsp';
         
               startUrl += '?orgId=XXXXX&portalId=YYYYY&loginType=3';
               startUrl += '&startUrl=';
               startUrl += '&loginUrl=';
               startUrl += '&useSecure=true';
               startUrl += '&un=' + username;
               startUrl += '&pw='+ password;

     PageReference p = Site.login(username, password, startUrl);
      
      if (p == null){
          
          a.result = username+password+startUrl;
      }
      else{
          
          a.result = password+username;
      }
       return a;
       
   }

 

 

 

I can login to my portal from the link in the startURL if I input it in my browser and use the 'normal' way, but somehow my pageReference p is always NULL. The object gets returned to my php code and I have double checked all my strings like 1000 times. Why does it let me in using the normal login form, but not with a webservice? Is it the path of startUrl?

 

Do you guys have any direction for me?