PHPackages                             elliottlawson/laravel-socialite-linear - 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. elliottlawson/laravel-socialite-linear

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

elliottlawson/laravel-socialite-linear
======================================

Linear OAuth provider for Laravel Socialite

v0.1.0(5mo ago)1456↓20%[1 issues](https://github.com/elliottlawson/laravel-socialite-linear/issues)MITPHPPHP ^8.2CI passing

Since Nov 23Pushed 5mo agoCompare

[ Source](https://github.com/elliottlawson/laravel-socialite-linear)[ Packagist](https://packagist.org/packages/elliottlawson/laravel-socialite-linear)[ RSS](/packages/elliottlawson-laravel-socialite-linear/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

Laravel Socialite Linear Provider
=================================

[](#laravel-socialite-linear-provider)

A Laravel Socialite provider for authenticating with [Linear](https://linear.app) using OAuth 2.0.

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

[](#installation)

You can install the package via composer:

```
composer require elliottlawson/laravel-socialite-linear
```

Configuration
-------------

[](#configuration)

### 1. Create a Linear OAuth Application

[](#1-create-a-linear-oauth-application)

First, you'll need to create an OAuth application in Linear:

1. Go to your Linear workspace settings
2. Navigate to the "OAuth Applications" section
3. Click "New OAuth Application"
4. Enter your application details:
    - **Name**: Your application name
    - **Callback URL**: `https://yourdomain.com/auth/linear/callback`
5. Copy your **Client ID** and **Client Secret**

### 2. Add Credentials to Laravel

[](#2-add-credentials-to-laravel)

Add your Linear OAuth credentials to your `config/services.php` file:

```
'linear' => [
    'client_id' => env('LINEAR_CLIENT_ID'),
    'client_secret' => env('LINEAR_CLIENT_SECRET'),
    'redirect' => env('LINEAR_REDIRECT_URI'),
],
```

Then add the following to your `.env` file:

```
LINEAR_CLIENT_ID=your-client-id
LINEAR_CLIENT_SECRET=your-client-secret
LINEAR_REDIRECT_URI=https://yourdomain.com/auth/linear/callback
```

Usage
-----

[](#usage)

### Basic Authentication

[](#basic-authentication)

Use Socialite's typical workflow for OAuth authentication:

```
use Laravel\Socialite\Facades\Socialite;

// Redirect to Linear for authentication
Route::get('/auth/linear', function () {
    return Socialite::driver('linear')->redirect();
});

// Handle the callback from Linear
Route::get('/auth/linear/callback', function () {
    $user = Socialite::driver('linear')->user();

    // $user->token - OAuth access token
    // $user->refreshToken - Refresh token (if provided)
    // $user->expiresIn - Token expiration time
    // $user->getId() - Linear user ID
    // $user->getName() - User's name
    // $user->getEmail() - User's email
    // $user->getAvatar() - User's avatar URL

    // Create or update user in your database
    // Store the access token for API calls

    return redirect('/dashboard');
});
```

### Requesting Scopes

[](#requesting-scopes)

Linear supports the following OAuth scopes:

- `read` (required - always included by default)
- `write` - Write access to the user's Linear data

To request additional scopes:

```
return Socialite::driver('linear')
    ->scopes(['read', 'write'])
    ->redirect();
```

### Customizing User Fields

[](#customizing-user-fields)

By default, the provider requests `id`, `name`, `email`, and `avatarUrl` from Linear's API. You can customize which fields to retrieve:

```
return Socialite::driver('linear')
    ->fields(['id', 'name', 'email', 'avatarUrl', 'admin', 'active', 'timezone'])
    ->redirect();
```

Any valid Linear GraphQL viewer fields are supported. See [Linear's API documentation](https://studio.apollographql.com/public/Linear-API/variant/current/home) for available fields.

### Using the Access Token

[](#using-the-access-token)

After authentication, you can use the access token to make API calls to Linear. The token is available on the user object:

```
$user = Socialite::driver('linear')->user();
$accessToken = $user->token;

// Use this token with a Linear API client
// For example, with the GLHD Linear package:
$linear = new Linear\Client($accessToken);
```

### Token Refresh

[](#token-refresh)

Linear access tokens expire after 24 hours. Refresh tokens are provided by default for OAuth applications created after October 1, 2025. When you authenticate a user, you'll receive both tokens:

```
$user = Socialite::driver('linear')->user();

$accessToken = $user->token;
$refreshToken = $user->refreshToken; // Store this securely
$expiresIn = $user->expiresIn; // 86400 (24 hours)
```

To refresh an expired access token:

```
use Laravel\Socialite\Facades\Socialite;

$provider = Socialite::driver('linear');
$newToken = $provider->refreshToken($storedRefreshToken);

// Access the new tokens
$newAccessToken = $newToken->token;
$newRefreshToken = $newToken->refreshToken;
$expiresIn = $newToken->expiresIn;
```

### Stateless Authentication

[](#stateless-authentication)

For API-based authentication without sessions:

```
return Socialite::driver('linear')->stateless()->user();
```

User Data
---------

[](#user-data)

After authentication, the user object contains the following data from Linear:

```
[
    'id' => '12345',                              // Linear user ID
    'name' => 'John Doe',                        // User's name
    'email' => 'john@example.com',               // User's email
    'avatar' => 'https://example.com/avatar.jpg', // Avatar URL (may be null)
]
```

The raw user data from Linear's GraphQL API is also available via `$user->getRaw()`.

Testing
-------

[](#testing)

```
composer test
```

Code Quality
------------

[](#code-quality)

Run PHPStan:

```
composer analyse
```

Check code style:

```
composer format
```

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 10, 11, or 12
- Laravel Socialite 5.x

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance50

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 69.2% 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

Unknown

Total

1

Last Release

177d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6254cce9312896ac7e2d54852a67745f163aef7284adc749222dbff0f06c37f2?d=identicon)[elliottlawson](/maintainers/elliottlawson)

---

Top Contributors

[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (9 commits)")[![elliottlawson](https://avatars.githubusercontent.com/u/3441829?v=4)](https://github.com/elliottlawson "elliottlawson (4 commits)")

---

Tags

laravelAuthenticationoauthsocialitelinear

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/elliottlawson-laravel-socialite-linear/health.svg)

```
[![Health](https://phpackages.com/badges/elliottlawson-laravel-socialite-linear/health.svg)](https://phpackages.com/packages/elliottlawson-laravel-socialite-linear)
```

###  Alternatives

[socialiteproviders/manager

Easily add new or override built-in providers in Laravel Socialite.

42542.0M544](/packages/socialiteproviders-manager)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.0M3](/packages/auth0-login)[awes-io/auth

Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).

3826.7k1](/packages/awes-io-auth)[kovah/laravel-socialite-oidc

OpenID Connect OAuth2 Provider for Laravel Socialite

2073.7k](/packages/kovah-laravel-socialite-oidc)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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