Download the PHP package burnthebook/craft-oauth without Composer

On this page you can find all versions of the php package burnthebook/craft-oauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft-oauth

OAuth for Craft CMS

Adds OAuth Functionality to Craft CMS.

Requirements

This plugin requires Craft CMS 5.6.0 or later, and PHP 8.2 or later.

Installation

You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for "OAuth for Craft CMS". Then press "Install".

With Composer

Open your terminal and run the following commands:

Go to the project directory

cd /path/to/my-project.test

Tell Composer to load the plugin

composer require burnthebook/craft-oauth

Tell Craft to install the plugin

php craft plugin/install craft-oauth

Usage

You can configure OAuth providers either:

The plugin currently supports connecting to:

Provider Required Settings
GitHub Client ID, Client Secret
Google Client ID, Client Secret
Facebook Client ID, Client Secret
Instagram Client ID, Client Secret
LinkedIn Client ID, Client Secret

For each provider, you can define:

When connecting a provider, the plugin will handle:

After successful login, a user’s connected OAuth accounts will appear in the Craft Control Panel under: Admin → Users → {User} → OAuth Accounts as a table showing the linked providers and account IDs.

Adding a Custom Provider

If you need to connect to a non-standard OAuth2 provider, you can define a Custom Provider.

  1. Create a Provider class extending League\OAuth2\Client\Provider\AbstractProvider.
  2. (Optionally) Create a custom ResourceOwner class implementing ResourceOwnerInterface to handle user data. (This is only really necessary if you provide user data as a response to your access token request, and do not have a userInfo endpoint.)
  3. Define your provider in config/oauth.php like so:

[!IMPORTANT] Custom providers must be configured in config/oauth.php (not via the Craft Settings UI). You must supply a valid providerClass which implements the necessary OAuth behavior.

The plugin will automatically use your custom provider when the user attempts to log in via OAuth.

Example: Custom Provider Class

Here’s a basic example of a custom OAuth provider and resource owner you could use.

[!NOTE] The below code is provided as an example only, will need tweaking to your implementation and we cannot assist with custom providers. This plugin uses league/oauth2-client under the hood and any custom provider must conform to their standards.

Provider Class

composer.json:

Provider Class:

Resource Owner Class:

[!NOTE] YourProvider must extend League\OAuth2\Client\Provider\AbstractProvider (or in most cases, GenericProvider). YourResourceOwner must implement ResourceOwnerInterface and provide the toArray() method.


All versions of craft-oauth with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
craftcms/cms Version ^5.6.0
league/oauth2-client Version ^2.8
league/oauth2-facebook Version ^2.2
league/oauth2-github Version ^3.1
league/oauth2-google Version ^4.0
league/oauth2-instagram Version ^3.1
league/oauth2-linkedin Version ^5.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package burnthebook/craft-oauth contains the following files

Loading the files please wait ...