function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jyothi d 7jyothi d 7 

how pass encrypted login credentials in the url in salesforce ?


Hi,

how pass encrypted login credentials in the url in salesforce ? i don't want to use SSO,
Manj_SFDCManj_SFDC
Hi Jyothi,

you can append them in the URL and encrypt your URL

String URLLink = ‘Your URL/Parameters you want to encrypt’;
String encodedURL = EncodingUtil.urlEncode(targetString,’UTF-8′);
jyothi d 7jyothi d 7
Hi Manj , Thank you ,
 i write like this bt it is not passed in the url ,

 Blob cryptoKey = Blob.valueOf('1234567890123456');

 Blob data = Blob.valueOf(encrypt.Name);
         Blob encryptedData = Crypto.encryptWithManagedIV('AES128', cryptoKey , data );
         String b64Data = EncodingUtil.base64Encode(encryptedData);
         encrypt.name = b64Data ;
         
 PageReference pg = new PageReference ('/apex/EnD?un={!b64Data}');            
            
         pg.setRedirect(true);
         return pg;
jyothi d 7jyothi d 7
i want to login from sfdc to sql server , if possible can u share code plz , i want to understand the code how it is please
jyothi d 7jyothi d 7
*Hi Manj , Thank you , i write like this bt it is not passed in the url , Blob cryptoKey = Blob.valueOf('1234567890123456'); Blob data = Blob.valueOf(encrypt.Name); Blob encryptedData = Crypto.encryptWithManagedIV('AES128', cryptoKey , data ); String b64Data = EncodingUtil.base64Encode(encryptedData); encrypt.name = b64Data ; PageReference pg = new PageReference ('/apex/EnD?un={!b64Data}'); pg.setRedirect(true); return pg; i want to login from sfdc to sql server , if possible can u share code plz , i want to understand the code how it is please *
Manj_SFDCManj_SFDC
please try to print pg avlaue after the line
PageReference pg = new PageReference ('/apex/EnD?un={!b64Data}'); and paste the value here
jyothi d 7jyothi d 7
Hi Manj,

i tried like this , bt its not working 

 String URL ='/apex/EnD?pw={!b64Data2}&un={!b64Data}';
           
           system.debug('Here is your URL =' + URL);
        
           Pagereference Pageref = New pagereference(URL);
           pageRef.setRedirect(true);
           system.debug('here is your Pageref ='+ Pageref);
        
           return Pageref ;
jyothi d 7jyothi d 7
*Hi Manj, i tried like this , bt its not working String URL ='/apex/EnD?pw={!b64Data2}&un={!b64Data}'; system.debug('Here is your URL =' + URL); Pagereference Pageref = New pagereference(URL); pageRef.setRedirect(true); system.debug('here is your Pageref ='+ Pageref); return Pageref ;*
Manj_SFDCManj_SFDC
Hi Jyothi, what did it print in the debug console i.e the value of URL  and PageRef