Shopify Single Sign-On (SSO) using API Authentication

Shopify Single Sign-On (SSO) using API Authentication


The application programming interface (API) is the interface through which users can request access to protected resources. They must be equipped to ensure that applications and clients attempting to access data are authentic before proceeding to authorized full access once identity is confirmed. When a user tries to log in to a Shopify store with his existing credentials (username and password) stored in the application userbase, the miniOrange single sign-on (SSO) login app makes an API call to the user’s database for authentication, and his credentials are checked against the application user base. The user is granted access to the store if the response received from the application userbase is successful otherwise, access is denied. You can use this method to integrate Single Sign-On (SSO) into your Shopify Store, allowing users to authenticate via your user authentication API and allow access to the Shopify store.


api authentication in shopify

Consider a Company (Company A) has its users stored in the company database which is connected to their JAVA or any other tech stack application. They have API-based authentication for allowing the users to get logged in. The company has opened a Shopify store and they want to integrate SSO into the Shopify store. They don't know whether they need to integrate APIs in Store. SSO Application is a solution to their problem. The users can SSO into the store using their existing credentials present in the Company Database and if they are successfully authenticated then they will get logged in.

Pre-requisite : Single Sign On - SSO Application

To configure Shopify SSO using API Authentication, you will need to install the miniOrange Shopify Single Sign On - SSO Login on your Shopify store:

miniOrange provides secure Single Sign-On (SSO) access to your Shopify Stores (both Plus and Non plus Stores).


Step by Step guide for Configuring SSO into Shopify using API Authentication

1.  Setup Custom API authentication source in miniOrange Single Sign-On (SSO) Login App in Shopify

  • Login into your Shopify account. Now navigate to the App section and click on Single Sign On - SSO Login App.
  • shopify app section - single sign on application
  • Click on Setup IDP button in the top left in navigation bar.
  • Single Sign-On (SSO)for Shopify (Plus and Non Plus), Configure IDP for enabling Single Sign-On (SSO)
  • Navigate to User Stores and click on the Add User Store button.
  • shopify api authentication add user store
  • Switch to the API tab and select Custom API from the dropdown.
  • shopify api authentication - custom api configuration
  • Provide an API identifier name.
  • Under the Authentication Configuration section, paste the User Authentication URL that you copied in step 1 above.
  • You can pass API key via two different methods i.e. Request Header or Request Body.

In this method, The API key is sent as "Authorization_key" via request header. You can refer to the example below.

  • Provide the Header Name Authorization_key and its value i.e. Value of your API key that you copied in step 1.
  • Select the Method as GET.
  • Provide the Authentication Parameters as:
    Authentication Parameters {
    "username":"##username##",
    "password":"##password##"
    }
    Note: Extra parameters can be sent in the Authentication parameters section if required. These parameters are added in the format "parameter-name":"parameter-value".
  • shopify - api authentication with api key in header
  • Provide the Status field’s value as status and Status Message field’s value as message.
    Status Name of field in the server response that contains the status code
    Staus Message Name of the field that gives the description of the status in the response

In this method, The API key is sent as "api_key" parameter in the POST body as JSON.

To configure your provider to send API key as a field in request body, you can refer below.

  • In the headers section, provide the Header Name Content-Type and its value application/json.
    (The content-type in the header specifies what type of data is actually sent in the request. Some examples of Content-type can be: application/json; text/html; charset=UTF-8; multipart/form-data; text/plain, etc.)
  • Select the Method as POST.
  • Provide the Authentication Parameters as:
    Authentication Parameters {
    "api_key":"value",
    "username":"##username##",
    "password":"##password##"
    }
    Put the API key value that you copied in step 1 in place of 'value'.
    Note: Extra parameters can be sent in the Authentication parameters section if required. These parameters can be added as fields in request body in the format "parameter-name":"parameter-value".

  • Shopify authentication via api - source authentication parameters
  • Provide the Status field’s value as status and Status Message field’s value as message.
    Status Name of field in the server response that contains the status code
    Staus Message Name of the field that gives the description of the status in the response
  • (Optional) You can configure extra attributes to be sent from your API source to Shopify. For this, click on the Send Configured Attributes toggle button. You will now be able to see Attribute mapping fields.

    In the first field write the name of the attribute that would be sent to Shopify. In the next field write the name of the attribute that will be received from the API source.


  • authentication via api into shopify - attribute mapping section
  • Click on the Save.

Step 2. Test Connection

  • To test the connection, select the user store you just added and click on Test Authorization API.
  • shopify api authentication - test authorization api
  • Enter your credentials when prompted and you should be able to see a success message.
  • shopify single sign on - test success window

3. Testing SSO for your Shopify Store

  • Go to your Shopify Store login page.(https://<your-shopify-storedomain>/account/login)
  • Click on the login button you customized earlier.
  • select project google oauth provider
  • You’ll be redirected to the login page of the IDP you configured in previous step. Log in with your IDP account credentials.
  • You’ll be successfully logged in to your Shopify store.

Hence you have successfully configured Shopify Single Sign-On (SSO) using API Authentication.

Additional Resources


If you are looking for anything which you cannot find, please drop us an email on shopifysupport@xecurify.com.

Hello there!

Need Help? We are right here!

support
Contact miniOrange Support
success

Thanks for your inquiry.

If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com