OAuth Single Sign-On (SSO) For Laravel Using Azure AD As OAuth provider

OAuth Single Sign-On (SSO) For Laravel Using Azure AD As OAuth provider


Laravel OAuth Single Sign-On (SSO) plugin gives the ability to enable OAuth Single Sign-On for your laravel applications. Using Single Sign-On you can use only one password to access your laravel application and services. Our plugin is compatible with all the OAuth compliant Identity providers. Here we will go through a step-by-step guide to configure Single Sign-On (SSO) between Laravel and Azure AD considering Azure AD as OAuth provider.

Pre-requisites : Download And Installation

  • Open a Command Prompt window and change the working directory to your Laravel app's main directory.
  • Enter the below command.
    composer require miniorange/oauth-laravel-free
  • After successful installation of package, go to your Laravel app in the browser and enter {laravel-application-domain}/ssologin.php?option=oauthredirect in the address bar.
  • The package will start setting up your database for you and then redirect you to the admin registration page.
  • Register or log in with your account by clicking the Register button to configure the plugin.
  • Laravel Single Sign On SSO plugin settings
  • After login, you will see the OAuth provider Settings option, where you will get the Redirect/Callback URL. Keep it handy as it will be required later to configure step 1.
  • Laravel Single Sign On SSO OAuth Client Settings

Steps to configure Azure AD Single Sign-On (SSO) Login into Laravel

1. Configure Azure AD as OAuth Provider

  • Sign in to Azure portal.
  • Select Azure Active Directory.
  • Azure AD Single Sign-on (SSO) - Login
  • In the left-hand navigation pane, click the App registrations service, and click New registration.
  • Azure AD Single Sign-on (SSO) - App-Registration
  • When the Create page appears, enter your application's registration information.(Refer to the below table)
    • Name : Name of your application.
      Application type :
      1. Select "Web app / API" for client applications and resource/API applications that are installed on a secure server. This setting is used for OAuth confidential web clients and public user-agent-based clients. The same application can also expose both a client and resource/API.
      Redirect URI :
      1. For "Web app / API" applications, provide the base URL of your app. eg, https://<domain-name> might be the URL for a web app running on your local machine. Users would use this URL to sign in to a web client application.
  • Make sure the "Grant admin consent to openid and offline_access permissions" option is enabled. When finished, click Register.
  • Azure AD Single Sign-on (SSO) - Overview
  • Azure AD assigns a unique Application ID to your application. The Application ID is your Client ID and the Directory ID is your Tenant ID, keep these values handy as you will need them to configure the miniOrange OAuth Client plugin.
  • Azure AD Single Sign-on (SSO) - Overview
  • Go to Certificates and Secrets from the left navigaton pane and click on New Client Secret. Enter description and expiration time and click on ADD option.
  • Azure AD Single Sign-on (SSO) - secret-Key
  • Copy the secret key "value" and keep the value handy it will be required later to configure Client Secret under the miniOrange OAuth Client Plugin.
  • Azure AD Single Sign-on (SSO) - Secret-Key-2

2. Configure Laravel OAuth plugin as OAuth Client

  • Go to the miniOrange Laravel OAuth SSO plugin and click on Choose you OAuth provider.
  • Laravel Single Sign On SSO select app
  • Enter the Client ID, Client Secret, Tenant and other required details. Click on Save Settings button.
  • Laravel Single Sign On SSO save settings

3. SSO Options

  • You can also use a link to login via your OAuth/OpenID provider.
  • This link is in the format:
    {laravel-application-domain}/ssologin.php?option=oauthredirect

In this Guide, you have successfully configured Azure AD OAuth Single Sign-On (Azure AD SSO Login) choosing Azure AD as OAuth provider and Laravel as OAuth Client using miniOrange plugin-OAuth Single Sign On – SSO Login. This solution ensures that you are ready to roll out secure access to your Laravel site using Azure AD login credentials within minutes.

Additional Resources

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