PHPackages                             jhayiwg/msofficeauth - 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. jhayiwg/msofficeauth

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

jhayiwg/msofficeauth
====================

Laravel Office 365 server to server token management

05PHP

Since Aug 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jhayiwg/msofficeauth)[ Packagist](https://packagist.org/packages/jhayiwg/msofficeauth)[ RSS](/packages/jhayiwg-msofficeauth/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Office 365 server to server token management
====================================================

[](#laravel-office-365-server-to-server-token-management)

This package if for server to server processing.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require jhayiwg/msofficeauth
```

Usage
-----

[](#usage)

Add to your .env, check  for referrence

```
OAUTH_APP_ID="XXXX"
OAUTH_APP_PASSWORD="XXXXX"
OAUTH_REDIRECT_URI=https://yoursite.loc/office/auth
OAUTH_SCOPES='openid profile offline_access user.read mail.read'
OAUTH_AUTHORITY=https://login.microsoftonline.com/common
OAUTH_AUTHORIZE_ENDPOINT=/oauth2/v2.0/authorize
OAUTH_TOKEN_ENDPOINT=/oauth2/v2.0/token

```

### Authentication and Authorization

[](#authentication-and-authorization)

After setting up, visit visiting , login to your ms account then authorize the app.

The package will store or re-generate the token on your storage folder.

### Automatic Injection

[](#automatic-injection)

To use in the controller

```
// Usage description here
namespace App\Http\Controllers;

use Microsoft\Graph\Model;
use LaraOffice\MsOfficeAuth\MsOfficeAuth;

class HomeController extends Controller
{
    public function index(MsOfficeAuth $msGraph)
    {
        $tokenExpired = $msGraph->getAccessToken() ? 'No' : 'Yes';
        $graph = $msGraph->graph();
        $user = $graph->createRequest('GET', '/me')
            ->setReturnType(Model\User::class)
            ->execute();
        $userEmail = $user->getMail();
        return view('home', compact('tokenExpired', 'userEmail'));
    }
}
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jhay](https://github.com/jhayiwg)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cef8e58fc1f6b2336fc915160132943db731163f5f0888b28ac223b329de5e62?d=identicon)[jhayiwg](/maintainers/jhayiwg)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/jhayiwg-msofficeauth/health.svg)

```
[![Health](https://phpackages.com/badges/jhayiwg-msofficeauth/health.svg)](https://phpackages.com/packages/jhayiwg-msofficeauth)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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