SSO and MODX?

LucyILucyI Member
I'm looking for a tutorial for setting up SSO to integrate Foxycart and MODX users. Most of the discussion I can find here or on the MODX forum is several years old. I have read your page on SSO and looked at the sample code, but 1.) I would need a more detailed, step-by-step plan , and 2.) I'm wondering if a MODX plugin has been developed to do just this. Seems like it would be a very common integration.

I think my specs are pretty standard:
1. MODX passes user credentials to Foxy if user is logged into MODX
2. Foxy passes credentials to MODX and creates new user or updates existing if email matches
3. Allow checkout as guest

Please advise. :)
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @Lucyl,

    Thanks for posting. We are fans of ModX, but unfortunately there hasn't been any recent plugins or anything developed within the community for Foxy, that I'm aware of at least. I'll check in with the team and see if there is something I've missed.

    An integration is definitely possible though - and there are some stores using ModX that have developed their own handling for some of Foxy's features, but it doesn't look like there is anything public for that work.


    In terms of the set up you're looking to achieve - it will work by making use of a few of our features, specifically the Datafeed, the API and Single Sign On. Unfortunately it's not necessarily as simple as a step by step process for building a SSO integration, that said - I can give you an overview of how those features connect to create the kind of set up you're after.

    The datafeed is sent to an endpoint of your choosing after each successful transaction, and includes details about that transaction. It allows you to do lots of things like tracking inventory, but for this set up, you'd use it to get the customer details, and create a user within ModX if one doesn't already exist. If one does - then it's worth updating the password with what came from the datafeed, just to ensure it's up to date with the latest (in case the customer reset their password while checking out for example).

    You would also use the API to update the customer record on FoxyCart whenever the user updates their details within ModX. For example, if they update their password within ModX, you'll want to ensure that's updated within Foxy as well.

    Finally, the SSO endpoint. This script sits on your server similar to the datafeed endpoint - but the customer is silently redirected to it when they attempt to proceed to the checkout. At this endpoint, you need to determine if the user is already logged in within ModX. If they are, you then either get their stored FoxyCart customer ID (if you're storing it against their customer record), or use the API to fetch that ID based on their email. You then forward them on to the checkout with the SSO auth tokens included, which means that when they hit the checkout, they'll be automatically logged in.

    On the SSO endpoint - if the user isn't logged in, you can simply send them on to the checkout with auth tokens generated against a customer ID of 0 - which represents a guest. The customer could then login or create an account on the checkout, or continue as a guest through the whole process.

    Does that help provide some additional context for what would be involved? We're happy to answer any other questions you may have about getting it set up. Alternatively, if it's beyond what you're comfortable developing, we could also pass on some details of developers who could assist you with getting an integration set up as you need it.
Sign In or Register to comment.