Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Help getting started on SSO

Im just trying to create a simple single sign on. I have uploaded the example php file, and just for testing purposes hard coded in a customer id and set authentication to true.
I am getting a Access-Control-Allow-Origin error. And when I manually put in the information I get a error saying my cart is empty and no account is logged in.

What am I doing wrong here.
  • This particular part of the php code doesn't appear to be working:

    $return_hash = '';
    $customer_id = 0;
    $timestamp = 0;
    $fcsid = '';

    if ($user_is_authenticated) {
    $customer_id = $foxycart_customer_id;
    if (isset($_REQUEST['timestamp']) && isset($_REQUEST['fcsid'])) {
    $fcsid = $_REQUEST['fcsid'];
    $timestamp = $_REQUEST['timestamp'] + (60 * 30); // valid for 30 minutes;

    the redirect URL is outputting:

    The timestamp and fcsid aren't set.
  • fc_adamfc_adam FoxyCart Team

    Just to confirm - are you hitting the SSO endpoint directly yourself, or have you set it as the store's SSO endpoint and you're moving from the cart to the checkout?
  • I think that would be hitting it directly myself.
  • fc_adamfc_adam FoxyCart Team

    The endpoint relies on having URL parameters sent to it that FoxyCart is communicating as part of that redirect. That includes the session ID and a timestamp - which is why you're not seeing them when you hit it directly.
  • What does the fcsid need to be?
  • fc_adamfc_adam FoxyCart Team

    The fcsid needs to be the current customers FoxyCart session ID. When our server redirects the customer to your SSO endpoint, it passes along the current session ID as well as the server timestamp - which is used to validate the returned variables from your script.
  • Adam,
    For now I just need to set up a simple login where customers can cancel their order. I'm guessing the best way to do that is with php and curl.
    I used the sample php code on:
    But I'm guessing I need more.
    Thanks for your help.
  • fc_adamfc_adam FoxyCart Team

    Let's take a step back. Are you wanting to allow a logged in user on your site to be automatically logged in on the FoxyCart checkout when they head there, or are you wanting to allow a user to login on your website using the same credentials they created on the FoxyCart checkout?
  • Using the same credentials they created on the FoxyCart checkout.
  • fc_adamfc_adam FoxyCart Team

    Ok, awesome - so that does revolve around the single sign on functionality, but is more than just the SSO endpoint. The SSO endpoint is for synchronising a users logged in status between your website and the checkout, and is positioned right before the customer hits the checkout. When they do that, FoxyCart quickly redirects the user to your SSO endpoint script - where you check if they're logged in, and a FoxyCart customer - and then you redirect them back to the checkout with the required parameters in the URL.

    For actually synchronising the logins back to your website - that makes use of other functionality, specifically the datafeed and also in part the API. The datafeed is sent to an endpoint on your side after each successful transaction is completed. At that endpoint you would then create the user on your side, capturing the users email and password from the datafeed content. You would also need to ensure your system and your FoxyCart store are set to use the same password hashing method as well.

    So that would get the customers login credentials synced to your side. To ensure everything remains in sync, there are a couple additional aspects to it - such as if the customer is able to make changes to their details on your side, to then synchronise those changes back to FoxyCart using the API.

    Combining all three of those aspects together - you'd have a seamless login system for your customers - wherever they login from, their credentials will be the same, and if they're logged in already from your website - their login state carries over to the checkout.

    Details on all of those aspects at these URL's:
  • Thanks Adam,
    I have read through each of those documents before. But I would like to do something a little simpler than that for right now. Our current backend is difficult to interact with, and is completely administered by another company. Getting the changes we need is taking too long, so we are tabling a complete integration for a few months.

    All I need is a way customers can login purely based on your system, not synchronizing with anything else. Primarily we just need a way for them to cancel their Autoship orders by starting at our website, and not needing to call us, or use the link from their receipt.

    How can most easily do that?
  • brettbrett FoxyCart Team
    edited March 2015
    @jrwhip, could you drop us an email about this? It might be easier to discuss there. Thanks!
  • brettbrett FoxyCart Team
    Public followup: We've added some docs there to roll your own customer portal.
Sign In or Register to comment.