PHPackages                             osapon/oauth2-line - 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. osapon/oauth2-line

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

osapon/oauth2-line
==================

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

94.0k↓41.2%8PHP

Since Oct 16Pushed 8y ago1 watchersCompare

[ Source](https://github.com/osapon/oauth2-line)[ Packagist](https://packagist.org/packages/osapon/oauth2-line)[ RSS](/packages/osapon-oauth2-line/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

LINE Provider for OAuth 2.0 Client
==================================

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

[![License](https://camo.githubusercontent.com/61a777322f593e21e4d6b9d4fe65ffc48688a66a6a5ef14a2cc08addf13376a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c65616775652f6f61757468322d676f6f676c652e737667)](https://github.com/thephpleague/oauth2-google/blob/master/LICENSE)

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

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

[](#installation)

To install, use composer:

```
composer require osapon/oauth2-line

```

Usage
-----

[](#usage)

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Osapon\OAuth2\Client\Provider\Line([
    'clientId'     => '{Channel ID}',
    'clientSecret' => '{Channel secret}',
    'redirectUri'  => '{Redirect URL}',
]);

if (!empty($_GET['error'])) {

    // Got an error, probably user denied access
    exit('Got error: ' . $_GET['error']);

} elseif (empty($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: ' . $authUrl);
    exit;

} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    // State is invalid, possible CSRF attack in progress
    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the owner details
        $ownerDetails = $provider->getResourceOwner($token);

        // Use these details to create a new profile
        printf('Hello %s!', $ownerDetails->getName());

    } catch (Exception $e) {

        // Failed to get user details
        exit('Something went wrong: ' . $e->getMessage());

    }

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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/904dd8a3b6dceac2f0108091d777fa3376e73e536dd05a32e65b32f7db8343ef?d=identicon)[osapon](/maintainers/osapon)

---

Top Contributors

[![inecmc](https://avatars.githubusercontent.com/u/4555954?v=4)](https://github.com/inecmc "inecmc (1 commits)")[![osapon](https://avatars.githubusercontent.com/u/529990?v=4)](https://github.com/osapon "osapon (1 commits)")

### Embed Badge

![Health badge](/badges/osapon-oauth2-line/health.svg)

```
[![Health](https://phpackages.com/badges/osapon-oauth2-line/health.svg)](https://phpackages.com/packages/osapon-oauth2-line)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.3M17](/packages/kartik-v-yii2-password)[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)

PHPackages © 2026

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