Download the PHP package adamwathan/eloquent-oauth without Composer

On this page you can find all versions of the php package adamwathan/eloquent-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 eloquent-oauth

Important: This package is not actively maintained. For bug fixes and new features, please fork.

Eloquent OAuth

This Project Has Been Deprecated. Code Climate Scrutinizer Code Quality Build Status

Eloquent OAuth is a package for Laravel designed to make authentication against various OAuth providers ridiculously brain-dead simple. Specify your client IDs and secrets in a config file, run a migration and after that it's just two method calls and you have OAuth integration.

Video Walkthrough

Screenshot

Basic example

Supported Providers

Feel free to open an issue if you would like support for a particular provider, or even better, submit a pull request.

Installation

Check the appropriate wrapper package for installation instructions for your version of Laravel.

Usage

Authentication against an OAuth provider is a multi-step process, but I have tried to simplify it as much as possible.

Authorizing with the provider

First you will need to define the authorization route. This is the route that your "Login" button will point to, and this route redirects the user to the provider's domain to authorize your app. After authorization, the provider will redirect the user back to your second route, which handles the rest of the authentication process.

To authorize the user, simply return the OAuth::authorize() method directly from the route.

Authenticating within your app

Next you need to define a route for authenticating against your app with the details returned by the provider.

For basic cases, you can simply call OAuth::login() with the provider name you are authenticating with. If the user rejected your application, this method will throw an ApplicationRejectedException which you can catch and handle as necessary.

The login method will create a new user if necessary, or update an existing user if they have already used your application before.

Once the login method succeeds, the user will be authenticated and available via Auth::user() just like if they had logged in through your application normally.

If you need to do anything with the newly created user, you can pass an optional closure as the second argument to the login method. This closure will receive the $user instance and a SocialNorm\User object that contains basic information from the OAuth provider, including:

Note: The Instagram and Soundcloud APIs do not allow you to retrieve the user's email address, so unfortunately that field will always be null for those provider.

Advanced: Storing additional data

Remember: One of the goals of the Eloquent OAuth package is to normalize the data received across all supported providers, so that you can count on those specific data items (explained above) being available in the $details object.

But, each provider offers its own sets of additional data. If you need to access or store additional data beyond the basics of what Eloquent OAuth's default ProviderUserDetails object supplies, you need to do two things:

  1. Request it from the provider, by extending its scope:

    Say for example we want to collect the user's gender when they login using Facebook.

    In the config/eloquent-oauth.php file, set the [scope] in the facebook provider section to include the public_profile scope, like this:

    For available scopes with each provider, consult that provider's API documentation.

    NOTE: By increasing the scope you will be asking the user to grant access to additional information. They will be informed of the scopes you're requesting. If you ask for too much unnecessary data, they may refuse. So exercise restraint when requesting additional scopes.

  2. Now where you do your OAuth::login, store the to your $user object by accessing the $details->raw()['KEY'] data:

    TIP: You can see what the available keys are by testing with dd($details->raw()); inside that same closure.


All versions of eloquent-oauth with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
illuminate/auth Version 4.*|5.*
illuminate/session Version 4.*|5.*
illuminate/database Version 4.*|5.*
illuminate/http Version 4.*|5.*
illuminate/routing Version 4.*|5.*
illuminate/support Version 4.*|5.*
socialnorm/socialnorm Version ^0.2
socialnorm/facebook Version ^0.2
socialnorm/github Version ^0.2
socialnorm/linkedin Version ^0.2
socialnorm/google Version ^0.2
socialnorm/instagram Version ^0.2
socialnorm/soundcloud Version ^0.2
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 adamwathan/eloquent-oauth contains the following files

Loading the files please wait ....