OAuth Single Sign-On (SSO) For Shopify Using AWS Cognito as Identity Provider
Overview
miniOrange allows AWS Cognito to act as an IDP (Identity Provider), which allows users to Single Sign-On (SSO) into Shopify using AWS Cognito Credentials. Our application is compatible with all the SAML / OAuth-compliant Identity Providers. We will go through a step-by-step guide to configure Single Sign-On (SSO) into Shopify using AWS Cognito as IdP (Identity Provider) and Shopify store as SP (Service Provider).
Pre-requisite: Shopify Single Sign-On - SSO Application
To configure SSO into Shopify with AWS Cognito as IDP, you will need to install the miniOrange Shopify Single Sign On - SSO Login application on your store.
Check out our video, to learn more about how Shopify SSO application works in Shopify.
Configuration Steps
Setup guide for Configuring AWS Cognito as IDP for SSO into Shopify
Step 1: Get the Callback URL from the Shopify SSO App
- Go to your Shopify store and navigate to the App section and click on Single Sign On - SSO login application.
- Click on the Add Identity Provider button to add your IDP.
- Select OAuth 2.0 protocol.
- Now choose AWS Cognito from the list of IDPs.
- Copy the OAuth Callback URL and keep it handy as it will be used in further steps.
Step 2: Configuring Shopify as a Service Provider (SP) in AWS Cognito
- Go to Amazon Console and sign up/log in to your account to Configure AWS Cognito.
- Search for Cognito in the AWS Services search bar as shown below.
Note: If you already have a User Pool then follow the steps provided here, else follow the steps provided below.
- Click on Create a User Pool button to create a new User Pool.
- Select the Application type as a Traditional web application. Provide a name for your application and choose the attributes in your user pool to be used during the sign-in process. Select the attributes that you require during the sign-up process from the Required attributes for the sign-up section.
- Paste the Callback URL that has been copied from Step 1 in the Return URL field under the Add a Return URL section. Click on the Create button.
- Scroll down and click on the Go to Overview button.
- To configure how your user pool sends email messages to users, navigate to the Authentication methods under the Authentication tab and click on Edit under the Email section.
- Here you can add email address from which your user pool sends email messages to users. Click on Save Changes.
- Navigate to the App Clients tab under the Applications section, and select your App Client. If you don't have an app client, then click on Create app client button.
- Copy the Client ID and Client Secret and keep them handy as they will be used in further steps.
- Go to the Attribute permissions tab. Click on the Edit and select the attributes that you want during the sign-up process. Click on Save.
- Now go to the Login pages tab and click on the Edit button as shown in the below image.
- Verify that the Callback URL is added to the URL field under the Allowed Callback URLs section and under the Identity Provider section, the Identity Provider selected is the Cognito user pool, and select Authorization code grant under the OAuth 2.0 grant types. Under the OpenID Connect scopes section the scopes selected are Email, OpenID, and Profile. (Please refer to the images below) Click on the Save Changes button.
- Go to the Users tab under the User Management section, and click Create user.
- Enter details such as email address, phone number & password. Click on Create user to save the details.
- Go to the Domain tab under the Branding section and copy the complete domain name {your domain name}.auth.{region name}.amazoncognito.com. This should be entered into the endpoints field under the Shopify Single Sign-On (SSO) application so keep them handy.
You have completed the AWS Cognito side configuration to configure SSO into Shopify using AWS Cognito Credentials.
Step 3: Configure AWS Cognito as IDP in Shopify
- Navigate back to the miniOrange Single Sign On-SSO application and click on the Add Identity Provider button.
- Select OAuth 2.0 protocol.
- From the list of IDPs, select AWS Cognito.
- Now, fill in the required details like Client ID, Client Secret, Endpoints, and Scope.
- Please refer to the below table for configuring the values.
IDP Display Name | Choose the appropriate name |
Authorize Endpoint | https://{cognito-app-domain}/oauth2/authorize |
Access Token Endpoint | https://{cognito-app-domain}/oauth2/token |
User Info Endpoint (optional) | https://{cognito-app-domain}/oauth2/userInfo |
Client ID | from Step 2 |
Client secret | from Step 2 |
Scope | openid |
- Now you can click on Save.
You have completed the Shopify side configuration to set up SSO between AWS Cognito and Shopify.
Step 4: Test Connection
-
After saving the IDP configuration, you will be redirected to the Test Connection step.
Please perform Test Connection before mapping or fetching attributes, test connection ensures that your IDP configuration is correct. - Click on the Test Connection button.
- On entering valid AWS Cognito account credentials you will see a pop-up window which is shown in the below screen.
- Click on the Fetch Attributes button to fetch the IDP attribute.
Step 5: Attribute Mapping
- Click on the + Attribute Mapping button to map attributes between Shopify and Cognito.
- Map the attributes by referring to the table below:
Attribute Name in Shopify | Choose the attribute from the list of predefined attributes |
Attribute Type | IDP Attribute |
Attribute Value | Select the attribute value you have fetched from your IDP |
- Click on Save.
- Navigate to the application home page. Go to More actions against the IDP you have configured and click on the Make Default button to make the IDP default.
Step 6: Testing Single Sign-On (SSO) for your Shopify Store
-
Go to your Shopify Store login page.(https://
/account/login) - Click on the login button you customized earlier.
- If you encounter an "invalid or missing reCAPTCHA token" error accompanied by a "Something went wrong" message, refer to this FAQ to resolve the error.
- Otherwise, you’ll be redirected to the login page of the IDP you configured in the previous step. Log in with your IDP account credentials.
- You’ll be successfully logged in to your Shopify store.
In this Guide, you have configured AWS Cognito Single Sign-On (SSO) by configuring AWS Cognito as an OAuth Provider and Shopify as an OAuth Client using our Shopify Single Sign-On - SSO Login App. This solution ensures that you are ready to roll out secure access to your Shopify Store using AWS Cognito login credentials within minutes.
FAQs
More FAQs ➔I have followed the steps to set IDP but where can I check SSO?
Follow the steps outlined here to configure SSO in Shopify with your preferred IDP.
I installed the Shopify SSO application. I clicked on the “SETUP IDP” option but nothing opened up.
Redirection to any other site might be blocked in the browser. Please follow the steps given here to resolve the issue.
After performing SSO, I want my customers to redirect to the collections or discount offer page.
Follow the steps outlined here to redirect your customer to collections/cart or any other page.
How do I enable the SSO application’s auto redirect to the IDP feature on my Shopify store?
You must upgrade to the SSO application’s Enterprise plan to enable the Auto-Redirect to the IDP feature. Follow the steps outlined here to enable this feature.
Additional Resources
Get in Touch
Please reach out to us at shopifysupport@xecurify.com, and our team will assist you with setting up the Shopify SSO application. Our team will help you to select the best suitable solution/plan as per your requirement.