PHPackages                             etracksystems/socialite-azure-app - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. etracksystems/socialite-azure-app

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

etracksystems/socialite-azure-app
=================================

Laravel Socialite provider for Oauth using azure, but scoped to a specific app api, allowing custom azure policies to be applied. Rather than using the MS graph endpoint which mean policies would have to be applied to that instead of the app

v2.1.1(5mo ago)01.0k↑157.1%PHPPHP ^8.4

Since Jul 15Pushed 5mo agoCompare

[ Source](https://github.com/etracksystems/socialite-azure-app)[ Packagist](https://packagist.org/packages/etracksystems/socialite-azure-app)[ RSS](/packages/etracksystems-socialite-azure-app/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (1)Versions (11)Used By (0)

Socialite Azure App Driver
==========================

[](#socialite-azure-app-driver)

Overview
--------

[](#overview)

The purpose of this provider is to provide Azure Oauth where you can apply *Condition Access Policies*. The default package from `socialiteproviders/microsoft-azure` scopes to the Graph api in order to get the user details. This doesnt allow Conditional Access Policies to be applied scoped solely to accessing your 3-party app. MS applies the policy to the resource you're access, in this case Graph api, and so, affects users as a whole rather than just when accessing your app.

This provider initially requests a scope just for the app, which allows the policies to applied scoped to just this context. In the callback, the token is exchanged for a Graph one, which then allow us to query the Graph endpoint to get the user details.

Installation &amp; Basic Usage
------------------------------

[](#installation--basic-usage)

```
composer require etracksystems/socialite-azure-app
```

### Azure

[](#azure)

Register an App with Microsoft Entra ID. Expose an API endpoint on that app, and make sure to keep the Application ID URI as the client id, example: `api://e1b40bb5-28da-4b55-a13b-0e121df684f3`

Add a scope to this endpoint with the name `access`. A custom name can be used, but remember to provide the value in your ENV setup under the key `AZURE_ENDPOINT_NAME`. Its this scope that is initially requested in the oauth flow.

Please see the [Base Installation Guide](https://socialiteproviders.com/usage/), then follow the provider specific instructions below.

### Add configuration to your `config/services.php`

[](#add-configuration-to-your-configservicesphp)

```
'azure-app' => [
  'client_id' => env('AZURE_CLIENT_ID'),
  'client_secret' => env('AZURE_CLIENT_SECRET'),
  'redirect' => env('AZURE_REDIRECT_URI'),
  'tenant' => env('AZURE_TENANT_ID'),
  'endpoint_name' => env('AZURE_ENDPOINT_NAME')
],
```

### Usage

[](#usage)

You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):

```
return Socialite::driver('azure-app')->redirect();
```

To logout of your app and Azure:

```
public function logout(Request $request)
{
     Auth::guard()->logout();
     $request->session()->flush();
     $azureLogoutUrl = Socialite::driver('azure-app')->getLogoutUrl(route('login'));
     return redirect($azureLogoutUrl);
}
```

### Returned User fields

[](#returned-user-fields)

- `id`
- `name`
- `email`

Advanced usage
--------------

[](#advanced-usage)

In order to have multiple / different Active directories on Azure (i.e. multiple tenants) The same driver can be used but with a different config:

```
/**
 * Returns a custom config for this specific Azure AD connection / directory
 * @return \SocialiteProviders\Manager\Config
 */
function getConfig(): \SocialiteProviders\Manager\Config
{
  return new \SocialiteProviders\Manager\Config(
    env('AD_CLIENT_ID', 'some-client-id'), // a different clientID for this separate Azure directory
    env('AD_CLIENT_SECRET'), // a different secret for this separate Azure directory
    url(env('AD_REDIRECT_PATH', '/azuread/callback')), // the redirect path i.e. a different callback to the other azureAD callbacks
    env('AD_TENANT_ID'), // the azure tenant id which the app is associated to
    env('AD_ENDPOINT_NAME') // different endpoint name if not default of 'access'
  );
}
//....//
Socialite::driver('azure-app')
    ->setConfig(getConfig())
    ->redirect();
```

This also applies to the callback for getting the user credentials that one has to remember to inject the `->setConfig($config)`-method i.e.:

```
$socialUser = Socialite::driver('azure-app')
    ->setConfig(getConfig())
    ->user();
```

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance69

Regular maintenance activity

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~43 days

Total

9

Last Release

179d ago

Major Versions

v1.0.0 → v2.0.02025-07-16

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1843048?v=4)[Andrew Cowan](/maintainers/andycowan)[@andycowan](https://github.com/andycowan)

---

Top Contributors

[![stemple231](https://avatars.githubusercontent.com/u/199585050?v=4)](https://github.com/stemple231 "stemple231 (4 commits)")

---

Tags

laravelprovideroauthsocialitemicrosoftazure

### Embed Badge

![Health badge](/badges/etracksystems-socialite-azure-app/health.svg)

```
[![Health](https://phpackages.com/badges/etracksystems-socialite-azure-app/health.svg)](https://phpackages.com/packages/etracksystems-socialite-azure-app)
```

###  Alternatives

[socialiteproviders/microsoft-azure

Microsoft Azure OAuth2 Provider for Laravel Socialite

597.2M27](/packages/socialiteproviders-microsoft-azure)[socialiteproviders/microsoft

Microsoft OAuth2 Provider for Laravel Socialite

347.3M25](/packages/socialiteproviders-microsoft)[socialiteproviders/apple

Apple OAuth2 Provider for Laravel Socialite

629.5M15](/packages/socialiteproviders-apple)[socialiteproviders/instagram

Instagram OAuth2 Provider for Laravel Socialite

402.0M5](/packages/socialiteproviders-instagram)[socialiteproviders/saml2

SAML2 Service Provider for Laravel Socialite

172.6M5](/packages/socialiteproviders-saml2)[kovah/laravel-socialite-oidc

OpenID Connect OAuth2 Provider for Laravel Socialite

24133.8k](/packages/kovah-laravel-socialite-oidc)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
