PHPackages                             fyennyi/oauth2-vercel - 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. fyennyi/oauth2-vercel

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

fyennyi/oauth2-vercel
=====================

Vercel OAuth 2.0 Client Provider for The PHP League OAuth2-Client.

00PHPCI failing

Since Feb 23Pushed 2mo agoCompare

[ Source](https://github.com/Fyennyi/oauth2-vercel)[ Packagist](https://packagist.org/packages/fyennyi/oauth2-vercel)[ RSS](/packages/fyennyi-oauth2-vercel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Vercel Provider for OAuth 2.0 Client
====================================

[](#vercel-provider-for-oauth-20-client)

[![Latest Stable Version](https://camo.githubusercontent.com/7a023f0efed8e349626e9ff6b18eb0ad2729b404025c7c790764c3a059948153/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6679656e6e79692f6f61757468322d76657263656c2e7376673f6c6162656c3d5061636b6167697374266c6f676f3d7061636b6167697374)](https://packagist.org/packages/fyennyi/oauth2-vercel)[![Total Downloads](https://camo.githubusercontent.com/8a39ef09bf03ecd0830071f3b26fcf627786e9ba5850ea10fe9b78613995b8dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6679656e6e79692f6f61757468322d76657263656c2e7376673f6c6162656c3d446f776e6c6f616473266c6f676f3d7061636b6167697374)](https://packagist.org/packages/fyennyi/oauth2-vercel)[![License](https://camo.githubusercontent.com/af3c9377569fd3894d7b5f0693466e1bf50865b20d317f987ea8b2ee9fa6c750/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6679656e6e79692f6f61757468322d76657263656c2e7376673f6c6162656c3d4c6963656e6365266c6f676f3d6f70656e2d736f757263652d696e6974696174697665)](https://packagist.org/packages/fyennyi/oauth2-vercel)[![Static Analysis](https://camo.githubusercontent.com/e1352e56f029a49458e762db97567d9351461640ebc742a0148c6781921ac7d6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4679656e6e79692f6f61757468322d76657263656c2f7068707374616e2e796d6c3f6c6162656c3d5048505374616e266c6f676f3d676974687562)](https://github.com/Fyennyi/oauth2-vercel/actions/workflows/phpstan.yml)

This package provides Vercel OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

Features
--------

[](#features)

- **Full OAuth 2.0 &amp; OIDC Support**: Implements authorization code flow with PKCE.
- **Automatic Endpoint Discovery**: Configures endpoints from Vercel's OIDC discovery document.
- **ID Token Validation**: Cryptographically validates ID tokens using JWKS.
- **Token Introspection**: Check token validity and metadata.
- **Token Revocation**: Invalidate tokens when needed.
- **Easy Integration**: Works seamlessly with `league/oauth2-client`.

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

[](#installation)

Install via Composer:

```
composer require fyennyi/oauth2-vercel
```

### Requirements

[](#requirements)

- PHP 8.0 or higher
- `league/oauth2-client` ^2.0
- `guzzlehttp/guzzle` ^7.0
- `firebase/php-jwt` ^7.0

Quick Start
-----------

[](#quick-start)

### 1. Create a Vercel App

[](#1-create-a-vercel-app)

Before using this library, you need to create an app in your Vercel account:

1. Go to your [Vercel Team Settings](https://vercel.com/dashboard/settings)
2. Navigate to **Apps** and click **Create**
3. Configure your app:
    - **Name**: Your app name
    - **Client Authentication**: Choose your preferred method
    - **Authorization Callback URL**: Add your callback URL (e.g., `https://yourapp.com/callback`)
    - **Permissions**: Select scopes (`openid`, `email`, `profile`, `offline_access`)
4. Generate a **Client Secret** (if using confidential client authentication)
5. Save your **Client ID** and **Client Secret**

### 2. Initialize the Provider

[](#2-initialize-the-provider)

```
