PHPackages                             venveo/craft-oauthclient - 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. venveo/craft-oauthclient

ActiveCraft-plugin[Authentication &amp; Authorization](/categories/authentication)

venveo/craft-oauthclient
========================

Simple OAuth 2.0 client

2.1.9(5y ago)96.8k3[18 issues](https://github.com/venveo/craft-oauthclient/issues)[1 PRs](https://github.com/venveo/craft-oauthclient/pulls)3MITPHPCI failing

Since Apr 15Pushed 3y ago3 watchersCompare

[ Source](https://github.com/venveo/craft-oauthclient)[ Packagist](https://packagist.org/packages/venveo/craft-oauthclient)[ RSS](/packages/venveo-craft-oauthclient/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (5)Versions (21)Used By (3)

OAuth 2.0 Client plugin for Craft CMS 3
=======================================

[](#oauth-20-client-plugin-for-craft-cms-3)

This plugin provides developers with an easy centralized approach to managing and storing OAuth 2.0 clients and tokens.

It exposes an easy to use API and frontend for authorizing tokens for internal business logic. What it does not do is act as an authentication provider for users to login to the CMS.

Features
--------

[](#features)

- Simple API for integrating League OAuth Providers
- Lots of events for developers
- CLI for refreshing tokens
- Project config support
- 1-line Twig helper for generating authentication UI in your module

Example Use Cases
-----------------

[](#example-use-cases)

- Building a custom CRM integration
- Reading from and writing to Google Sheets
- Querying data on a business' Facebook page

Example Non-Use Cases
---------------------

[](#example-non-use-cases)

- Logging-in users on the frontend
- Allowing users to access the CP via social accounts
- Keeping track of many CMS users' social accounts

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

[](#requirements)

This plugin should work on Craft CMS 3.1.34.3 or later

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

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require venveo/craft-oauthclient

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for OAuth 2.0 Client.
4. Configure on Craft settings page

---

Providers
---------

[](#providers)

A provider in this context is an OAuth 2.0 server that is exposing an API via token authorization. Out of the box, this plugin ships with the following providers:

- Google
- Facebook
- GitHub

The plugin utilizes the widely used `oauth2-client` project by thephpleague in order to make adding providers as painless as possible. We add an additional layer to this abstraction in order to mix in requirements for Craft.

### Creating a Provider

[](#creating-a-provider)

Assuming a League provider already exists for your service, you can easily create your own implementation. In your module or plugin, create a file for the provider and follow this outline:

```
