Guide
The SSO API's purpose is to add Users to the MX platform, provide their credentials, and log the Users into MoneyDesktop. The API deals with three entities: Client, User, and Member.
A Client is a partner that contracts with MX.
A User will connect to MoneyDesktop through the Client's web page or service.
A User is a person. A User is added to a Client.
A Member is a container attached to the User that holds the credentials used to request the User's data from the Data Provider.
The Client GUID is required to be passed as the "c" parameter on the URL in every SSO API endpoint call. The Client GUID is required to ensure that the external_user_guid for the User is unique within each Client, otherwise collisions could occur between Clients. Either the client_guid or the external_client_guid may be used.
Each API call must also have an API key passed as the "k" parameter to identify the partner who is making the API call.
You will need to use a GUID to identify the Users and Members for the read and create API calls. You can use any value you have in your system for this purpose. It can be a GUID or ID that is already in your User table, a hash of their account number, or any other value that is unique and consistent. When you call the SSO API, you will use that GUID to identify the Users and Members. It is recommended to use your choice of GUID for the User and to derive a GUID for the Member based on the User GUID, such as "M-{userGUID}". This is the convention that will be used in the examples.
Basic SSO API workflow
- READ the User. If the user exists, skip to step 3.
- CREATE the User under the proper Client. Skip to step 4.
- READ the Member. If the member exists, skip to step 5.
- CREATE the Member, containing the credentials for that User. Skip to step 6.
- UPDATE the Member. If the credentials change or expire they should be refreshed at this point, otherwise this step can be omitted.
- Open MoneyDesktop.
When you log a User into MoneyDesktop you should always follow the API workflow. Perform the User read and create the User if needed. Next, perform the Member read and create the Member if needed. The Member read can be skipped and you can go straight to the Member create if it is immediately following a User create, but otherwise it should be performed each time. It is important to check both the User and the Member as outlined every time the User logs in. If an error or communication interruption occurs during the initial User and Member create requests you might end up with no User in the system, or else a User without a Member attached to hold the credentials. If you follow the API workflow as outlined then the User and/or the Member will be created the next time the User is logged into MoneyDesktop and the situation will resolve itself.
You do not have to keep track of Users that you have created on the MX platform if you follow the API workflow. You can simply check to see if they exist by doing a User read with your GUID, create them if they do not exist, do the same with the Member for that User, and then log the User in. Should you choose to keep track of which Users have been created inside the MX platform, you may do so, but you should still follow the API Workflow. This will allow the MX Client Services team to delete a User if it becomes necessary for some reason and the User and Member will automatically be recreated on the next login, even if you think they already exist in our system. It also prevents issues that would arise if your list of users gets out of synch with our system.
The Member update step needs to occur on every login to refresh the credentials if you use either an expiring userkey or if you use login and password. We highly recommend a userkey over the login and password. If you use a permanent userkey this step can be omitted from the API workflow.
Single Sign-On has now been accomplished and you can log the user . The response from the User read or the User create will contain the fields needed to open MoneyDesktop. The token in the response expires in ten minutes. If it is possible for that amount of time to expire between the time you do the initial Read or Create and when you open MoneyDesktop then you will need to do a fresh User read just before logging the user in.
Here is some specific information about each of the API calls you will need to use. These examples follow MX's Best Practices recommendations.
User read (GET request)
In the URL, you will pass the GUID for the User. The Client GUID to which the User belongs is passed in the "c" parameter of the URL. No headers or request body are required.
On a successful response (http response code 200), the body will contain a master_widget_url and also a guid and user_token. You can use either the master_widget_url or the guid and user_token to open the master widget. Please see the MoneyDesktop 4.0 guide on the developer portal for more information on how this is accomplished.
Do not attempt to parse the master_widget_url or any other URL provided in current or future SSO API response bodies. They are intended to be used directly as the src for an iFrame only. Their contents can change at any time.
User create (POST request)
This creates a User on the MX platform. Pass the GUID you want us to associate with that User in the external_user_guid parameter in the request body. This is the same GUID you will always use in the future when you do a User read. It can be any unique string you have in your system. You need to specify "Content-Type:application/json" in the request header.
On a successful response (http response code 200), the body will contain the same master_widget_url, guid, and user_token as does the User read response.
Pass the external_client_guid in the "c" parameter in the URL to specify which Client (Bank or Credit Union) is adding the User. This GUID is determined in advance between the Partner and MX and can be any string of your choosing for each Client. The first_name, last_name, email, phone, birthdate, sex, credit_score, and zip_code parameters are optional, but as much information should be passed as possible. This makes for a better user experience when the user first enters the software when this information is already present. The first and last names and email address are particularly important.
Member read (GET request)
In the URL, you will pass the GUID for the Member. The Client GUID to which the User belongs is passed in the "c" parameter. This call will tell you if the Member already exists or if the Member should be created. A successful response will return http response code 200.
Member create (POST request)
Whenever you create a User you will then Create a Member for that User to attach the credentials. These credentials will be used by MoneyDesktop when requesting the account and transaction data for that User.
The external_user_guid parameter identifies the User. Pass in the same User GUID in the Member create API call that you used when you created the User.
It is recommended, although not required, to set an external_member_guid for the member. This is important if you will need to update the credentials at a future time, otherwise you will need to store the MX-created member guid for this purpose. It is recommended that this GUID be manufactured by prepending a value to the user's external_user_guid, such as "M-". For example, if the user GUID was "ABCDE" the recommended member GUID would be "M-ABCDE". Do not use "MBR-" as the prefix because this prefix is reserved by the system.
The credentials parameter is required. The credentials can be either a username/password combination, or a userkey. The userkey can be a hashed or encrypted value of a member or account number, or it can be any other GUID that will uniquely identify the User during data collection. If you use the username/password credential or an expiring userkey then you must also implement the Member update API call to send updated credentials at each login.
You need to specify "Content-Type:application/json" in the request header.
A successful response will return http response code 200.
Do not use any other parameters. The name and institution_guid parameters should not be used unless instructed to do so by a MoneyDesktop integration engineer.
Member update (PUT request)
Use this to update the user's credentials on each login if the credentials are a login/password combination or an expiring userkey. You do not need to use this call if you use a permanent userkey as the credential.
In the URL, you will pass the GUID for the Member. This is the external_member_guid you specified when you created the Member. The Client GUID to which the User belongs is passed in the "c" parameter.
Pass the credentials as you did in the Member create call with their updated values.
You need to specify "Content-Type:application/json" in the request header.
A successful response will return http response code 200.