Apple Single Sign-On (SSO) OAuth / OpenID Connect into Magento | Magento Apple SSO Login

Apple Single Sign-On (SSO) OAuth / OpenID Connect into Magento | Magento Apple SSO Login


Integration of Apple Login (Apple OAuth Single Sign-On) with Magento using OAuth 2.0 Protocol. The Magento OAuth / OpenID Connect Single Sign-On (SSO) plugin makes it easy to use OAuth2 to set up Apple Login on Magento (Apple Single Sign on).

The plugin can be set up using other Social Media sources, as well as custom OAuth and OIDC providers. It contains a lot of Single Sign-On (SSO) features, like Attribute Mapping for user profiles, Role Mapping, and so on. In this guide, we'll go over how to set up SSO between Magento and Apple. At the end of this article, users should be able to log into Magento using Apple. Click here to read more about the Magento OAuth Single Sign-On (OAuth & OpenID Connect Client) plugin's extra features.

The Magento OAuth & OpenID Connect Single Sign-On (SSO) plugin makes it possible to log into Magento securely using Apple as an OAuth and OpenID Connect provider. You can also use alternative Oauth providers, such as Azure B2C, Office 365, and other custom providers, to configure the plugin. Advanced Single Sign-On features such as user profile Attribute Mapping, Role Mapping, and so on are supported. We'll go over how to set up SSO between Magento and Apple in this article. Users should be able to log in to Magento through Apple by the end of this guide.

Click here to know more about other features we provide in Magento OAuth Single Sign-On ( OAuth & OpenID Connect Client ) plugin

Pre-requisites : Download And Installation

  • You can download the miniOrange OAuth OpenID Connect SSO Free plugin from the Magento Marketplace.
  • Select Your Magento Store version from the Dropdown.
  • Click on Add to cart.
  • Go to the cart and checkout to buy the plugin.
  • Click on Download and save the miniOrange OAuth OpenID Connect SSO Plugin zip.
  • Unzip all contents of the zip inside the MiniOrange/OAuth directory.
  • Run the following commands on command prompt to enable the plugin
  •       1. php bin/magento setup:upgrade
          2. php bin/magento setup:di:compile

Steps to Configure Apple OAuth & OpenID Single Sign-On (SSO) Login into Magento

1. Setup Apple as OAuth Provider

Follow the steps below to configure Apple as OAuth Provider

miniorange img Configure Apple as OAuth Provider
  • First of all, go to https://developer.apple.com click on Account and Login with your Apple developer account.
  • apple single sign-on SSO Login to apple Magento apple single sign-on SSO create apple account
  • Click on Certificates, Identifiers & Profiles tab.
  • Magento apple single sign-on SSO login Certificates, Identifiers and Profiles
  • In the left menu Click on Identifiers and after that click on the Plus Icon(blue color) . Click on Continue for the next 2 pages.
  • Magento apple SSO login user Identifiers
  • Enter Description and Bundle ID for the App ID. (The Bundle ID should be in reverse-dns style string.)
  • apple single sign-on SSO login app Description
  • In the Capabilities section scroll down and select sign with apple and Click on Edit link.
  • apple single sign-on SSO login Capabilities and Enable as a primary App Id
  • Select Enable as a primary App Id and click on Save. Click on Continue and then click on Register.
  • apple single sign-on SSO primary App
  • In the right corner click on Continue and after that Register button.
  • Again click the Plus icon( blue color). Select Service IDs and click on Continue.
  • Magento 2 OAuth Plus icon
  • Enter Description and Identifier( Identifier would be your client id). and click on the Continue and after that Register button.
  • apple single sign-on SSO login description and clientid
  • Click on Keys tab from the left menu.Click on the Plus icon to register a new key.
  • Magento SSO Apple Login register a new key
  • Give your Key a name, and select Sign In with Apple and click on Configure button.
  • Oauth 2.0 Magento SSO login key
  • Select your Primary Id and click on the Save button and after that at the right corner click on Continue and Register button.
  • apple single sign-on SSO login app Register
  • Click on the Download button once the key is downloaded click on the Done button.
  • apple single sign-on SSO Download once the key is downloaded
  • In the left menu click on Identifiers and the right top click on App IDs.
  • apple single sign-on SSO select app id
  • Click on Service IDs from the drop down menu.
  • Magento Apple single sign-on SSO select service IDs is apple AppIDs
  • Select your Service Id from the List.
  • Magento single sign-on SSO select service IDs
  • Select Sign In with Apple and click on Configure button.
  • Magento apple single sign-on SSO login app configure
  • Select the Primary App Id from the drop down, and Enter the Domain and Redirect URL in Domains and Subdomains and Return URLs respectively and click on the Next button (You will get the Domain name and Redirect URL from miniOrange plugin).
  • apple single sign-on SSO social login apple redirectURL
  • Verify the details and click on the Done button. After that at the right corner click on the Continue button.
  • Copy the Identifier value and click on the Save button.
  • apple single sign-on SSO app id and secret
  • Enter the Identifier value in the Client ID and copy the downloaded key value in Client secret of the miniOrange OAuth Client plugin.

2. Generating Secret Key

  • Download the Ruby installer from the following link https://rubyinstaller.org/downloads/ and then install it.
  • Search for the Start command prompt with ruby open the ruby command prompt andinstall the JWT gem by running the following command on the command line:gem install JWT.
  • Copy the below code in a file and save the file with the .rb extension. Keep this .rb fileand downloaded .p8 file in the same folder.
  • Enter the name of downloaded file example= "key.P8", key_id , client_id, team_id in the code
  • Open Ruby command prompt and run the above code using the following command ruby filename.rb
  • require 'jwt'key_file = 'key.P8'
    team_id = ''
    client_id = ''
    key_id = ''
    ecdsa_key = OpenSSL::PKey::EC.new IO.read key_file
    headers = {
    'kid' => key_id
    }
    claims = {
    'iss' => team_id,
    'iat' => Time.now.to_i,
    'exp' => Time.now.to_i + 86400*180,
    'aud' => 'https://appleid.apple.com',
    'sub' => client_id,
    }
    token = JWT.encode claims, ecdsa_key, 'ES256', headers
    puts token
  • You will get your secret key. Copy the secret key.
  • Magento apple secret key

You have successfully configured Apple as OAuth Provider for achieving Apple Single Sign-On (SSO) with Magento for user authentication.

3. Configuring Magento 2 as OAuth Client

  • After successfully configuring OAuth Provider, go to OAuth Provider tab and configure OAuth Provider Name, Client ID, Client Secret, Scope and provided endpoints.

    Please refer below Endpoints to configure the OAuth client


    Scope: email
    Authorize Endpoint: https://appleid.apple.com/auth/authorize?response_mode=form_pos
    Access Token Endpoint: https://appleid.apple.com/auth/token
  • Click on the Save button to save the settings.
  • Click on the Test Configuration button.
  • Magento 2 OAuth credentials Apple SSO OAuth
  • You will see all the values returned by your OAuth Provider to Magento in a table. If you don't see value for First Name, Last Name, Email or Username, make the required settings in your OAuth Provider to return this information.
  • The miniOrange Premium Plugin also provides you the the feature to auto redirect your user to the IdP Login Page.
  • Magento 2 OAuth auto redirect to idp Magento SSO
  • Go to the Sign In Settings tab and check options to enable SSO on your Magento site.
  • Magento 2 OAuth enable SSO Magento SSO
  • You have successfully configured your Magento 2 as an OAuth Client. You will see the SSO button on your frontend. Click on the button and test the SSO.
  • Magento 2 OAuth SSO Apple SSO Apple magento SSO magento 2 OAuth client SSO Apple SSO

4: Attribute Mapping (Optional). *This is Premium feature.

  • You can map attributes in the Attribute Mapping tab. Only username and email are allowed to be mapped in free version of the plugin. However, in the premium version of the plugin, you can map various attributes coming from your OAuth Provider to the attributes present in your Magento site.
  • Magento 2 OAuth attribute mapping Magento SSO

5: Role Mapping (Optional). *This is Premium feature.

  • You can specify a default role in the free plugin that will be allocated to all non-admin users when they conduct SSO.
  • Go to Attribute/Role mapping tab and navigate to Role Mapping section.
  • Select the Default Role and click on the Save button.
  • Apple Magento SSO - Apple Single Sign-On(SSO) Login in Magento - role mapping

By configuring Apple as an OAuth Provider and Magento as an OAuth Client using our Magento OAuth Client plugin, you have successfully installed Magento Apple Single Sign-On (SSO). Within minutes, you'll be able to provide safe access to your Magento site utilising Apple login credentials thanks to this solution.

Additional Resources


If you are looking for anything which you cannot find, please drop us an email on magentosupport@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