cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Trusted Contributor

Fetch e-mail of signed in user

Hi,

In an old community we had a HTTP request that fetched the email of the signed in user to get this to another service so that we were able to have SSO without actually having SSO.

What the script did was the following:

When you press the link, the email to the logged in user is retrieved.

Then the following code was executed:

$ client = new Zend_Http_Client ("https://online.superoffice.com/cust9654/CS/scripts/customer.fcgi?action=safeParse&includeId=createSe...". $ email);
    
$ response = $ client-> request ("GET");
$ result = trim ($ response-> getBody ());

Here's a GET call against the address you see where the email to the logged in user is added.

What we get back from that call is a sessionkey that is used to send the user to the following location:

$ this -> _ redirect ("https://online.superoffice.com/cust9654/CS/scripts/customer.fcgi?_sf=0&custSessionKey=". $ result. "& customerLang = no & noCookies = true & action =". $ this-> getRequest () -> getPost ("action"));

Here you see that $ result is entered as custSessionKey in the URL and action is set to blank or newTicket if you choose to register new case etc etc.

Do anyne do this or know how to do this in Lithium (we are using SSO, but the service we have with this link is not connected to SSO and have unique login)?

1 Reply 1
Highlighted
Khoros Alumni (Retired)

The script you are describing can be converted to a combination of the FreeMarker markup language to expose the necessary email and a JavaScript client component which would perform the two calls to obtain the authentication token and use that to call the ackoffice.

For the first part to obtain the email:

You would use the appropriate FreeMarker context object to obtain the email address of a member. For the email of the currently signed in user the user context object would be your friend. So in your custom component's FreeMarker code you would use

${user.email}

to pass this to a JavaScript variable. This can then be accessed, e.g. via using the Lithium jQuery object to perform the necessary calls to superoffice.com

P.S.: This question is probably better suited for the Developer Discussion board.


Khoros Best Practice until August 2019. Onwards posting as Claudius.
Learn how to master Khoros. Learn Best Practice in the Community Documentation
If you appreciate my efforts, please give me a kudo ↓
Accept as solution to help others find it faster.