Quantcast
Channel: Blog – Stormpath User Identity API
Viewing all articles
Browse latest Browse all 278

Stormpath Loves Laravel Authentication

$
0
0

stormpath-laravel-driver

With over 100,000 installs of Laravel each month, many PHP developers are using the built-in authentication. The problem is that rolling your own authentication system and maintaining it is a full-time job in itself. Why not let Stormpath handle the authentication for you while using all the auth functions you are familiar with already?

We are excited to announce the Stormpath Laravel 5.1 Authentication Driver, our very first integration using the Stormpath PHP SDK. This new integration allows you to use all the auth facade functions that you are accustomed to while talking with your Stormpath application and directories.

Get Started with the Stormpath Laravel Authentication Driver

Let’s walk through a few steps to get you up and running. The following instructions will give you the ability to add the driver stormpath to your auth.php config.

auth_driver_setup

First, you need to install the auth driver package with composer. At the time of writing this article, the package is under an alpha tag, so you will need to change your minimum-stability to dev. Once this is done, you need to install the package.

"require": {
    "stormpath/laravel-auth-driver": "dev-master"
},

Doing this will allow you to register the service provider. This is done in config/app.php.

"providers" => [
    ...
    Stormpath\Providers\AuthServiceProvider::class
    ...
}

Now you have access to the auth driver. Change the driver you want to use for your application in config/auth.php. Find the key driver and change it to stormpath.

return [
   ...
   'driver' => 'stormpath',
   ...
]

The last thing to do is configure the package to use your keys and application. Run the following command to publish the config php artisan vendor:publish then open the file at config/stormpath.php. Here you will be able to provide your id, secret, and application.

NOTE Stormpath suggests not storing your id and secret within your repository. To avoid this, you can place these items in your .env.php file and change the config page to use the function env() to reference the information. For more details on this, please visit the docs at Laravel.

return [

    "id" => "YouStormpathId",

    "secret" => "YourStormpathSecret",

    "application" => "YourStormpathApplicationId"

];

Drop-In Auth Driver for Laravel Projects

Now you know how to change your auth driver for Laravel 5.1 to use Stormpath. You can include this in your current projects with very minimal code changes as well as start new projects with this package.

We hope you are as excited about this integration as we are and want to hear your feedback. Feel free to contact us at support@stormpath.com or give us a shoutout on Twitter @goStormpath.


Viewing all articles
Browse latest Browse all 278