All Projects → heloufir → simple-passport

heloufir / simple-passport

Licence: other
Simple passport, is a complete implementation of laravel/passport package, containing authentication, forgot passwort, recovery password, ... and all what you need to start your application that needs a complete authentication system

Programming Languages

HTML
75241 projects
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to simple-passport

passport
The Laravel passport compatible oauth extension for your Flarum forum.
Stars: ✭ 24 (+9.09%)
Mutual labels:  laravel-passport
laravel-passport-demo
Shows you how to turn your website to an Oauth2 server using Laravel Passport
Stars: ✭ 27 (+22.73%)
Mutual labels:  laravel-passport
docker-laravel-vuejs
🌟 🎯 📰 Dockerized Blog + Forum + REST API + App using Laravel, Vue.js
Stars: ✭ 27 (+22.73%)
Mutual labels:  laravel-passport
rest-api
Laravel restfull api boilerplate
Stars: ✭ 57 (+159.09%)
Mutual labels:  laravel-passport
vuetified
Laravel 5.5 Vuetify Real Time Starter App
Stars: ✭ 15 (-31.82%)
Mutual labels:  laravel-passport
ngx-security-starter
A full implementation of the heloufir/security-starter with an Angular 7+ front-end implementation, with a laravel 5.8.* server
Stars: ✭ 37 (+68.18%)
Mutual labels:  laravel-passport
laravel-api-auth
A Laravel Package for easy API authentication setup with passport
Stars: ✭ 29 (+31.82%)
Mutual labels:  laravel-passport
Clean-Laravel-Api
⭐️ Build APIs You Won't Hate In Laravel.
Stars: ✭ 85 (+286.36%)
Mutual labels:  laravel-passport
api.yike.io
一刻社区后端 API 源码
Stars: ✭ 1,019 (+4531.82%)
Mutual labels:  laravel-passport
security-starter
Security starter is a full implementation of laravel/passport and heloufir/simple-passport, containing all the implementations of the authentication and forgot password systems, which allows you to start your project from a good foundation, and only worry about the business logic of your application.
Stars: ✭ 31 (+40.91%)
Mutual labels:  laravel-passport
lumen-lighthouse-graphql
Lumen example use of a GraphQL PHP server using Lighthouse package
Stars: ✭ 31 (+40.91%)
Mutual labels:  laravel-passport
laravel-passport-socialite
The missing social authentication plugin (i.e. SocialGrant) for laravel passport.
Stars: ✭ 50 (+127.27%)
Mutual labels:  laravel-passport

Due to a time constraint, unfortunately this repository is no longer maintained.


Installation

1/ Install Laravel passport official package, explained in the documentation here Then install the simple-passport package via composer

composer require heloufir/simple-passport

Configuration

1/ After installing the package, you need to publish it, by running the command:

To do it, simply execute the following command

php artisan vendor:publish --provider=Heloufir\SimplePassport\SimplePassportServiceProvider

Or follow the steps below:

php artisan vendor:publish

You will be asked to choose what tag you want to publish (see the image below)

Publish heloufir/simple-passport package

Next you just need to choose the tag number to publish and tap Enter.

For my case I choosed 3 then Enter

Package heloufir/simple-passport published

This is the message you need to see if everything is OK.

2/ Now you need to configure the laravel/passport package, do it by following the below steps:

Execute the migration command:

php artisan migrate

This will show you the following message:

Migrating: 2019_04_06_105400_create_simple_tokens_table
Migrated:  2019_04_06_105400_create_simple_tokens_table

After running this command, add the Heloufir\SimplePassport\Helpers\CanResetPassword trait to your YOUR_NAMESPACE\User model. This trait will provide a few helper methods:

<?php

namespace App;
  
use Heloufir\SimplePassport\Helpers\CanResetPassword;
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
    
class User extends Authenticatable
{
    use HasApiTokens, Notifiable, CanResetPassword;
}

You can override two methods getEmailField and getPasswordField for providing the names of the fields

3/ A configuration file config/simple-passport.php will be published. its containing the information such as the user model and more things.

return [

    /*
    |--------------------------------------------------------------------------
    | Recover url
    |--------------------------------------------------------------------------
    |
    | This value is the recover password url, where the user will be redirected
    | after he clicked on the forgot password email button.
    | >> To customize this value please set a new variable into the application
    |    .env file with the following name: "SP_RECOVER_URL"
    |
    */
    'recover_url' => env('SP_RECOVER_URL', 'http://localhost:4200/auth/recover/'),

    /*
    |--------------------------------------------------------------------------
    | Mail sender
    |--------------------------------------------------------------------------
    |
    | This value is the address of the sender, which be displayed in the mail
    | sent to the user after he request to recover his password or after his
    | password is recovered
    | >> To customize this value please set a new variable into the application
    |    .env file with the following name: "SP_MAIL_FROM"
    |
    */
    'mail_from' => env('SP_MAIL_FROM', '[email protected]'),

    /*
    |--------------------------------------------------------------------------
    | Recover url
    |--------------------------------------------------------------------------
    |
    | This value is the name of the send, which be displayed in the mail
    | sent to the user after he request to recover his password or after his
    | password is recovered
    | >> To customize this value please set a new variable into the application
    |    .env file with the following name: "SP_MAIL_FROM_NAME"
    |
    */
    'mail_from_name' => env('SP_MAIL_FROM_NAME', 'Application'),

    /*
    |--------------------------------------------------------------------------
    | model
    |--------------------------------------------------------------------------
    |
    | The model that can use simple-passport features
    |
    */

    'model' => \App\User::class,

    /*
    |--------------------------------------------------------------------------
    | after_seconds
    |--------------------------------------------------------------------------
    |
    | How many seconds before dispatch the jobs to send mails
    |
    */

    'after_seconds' => 10,
];

It's done for the laravel/passport configuration, the rest of the configuration is done in the heloufir/simple-passport side.

So from here you are ready to use laravel/passport and heloufir/simple-passport packages.

Usage

Generate token

1/ You can generate a token for an existing user via a POST HTTP request to http://localhost/oauth/forgot-password containing an email field.

2/ You can recover the password for an existing user via a PUT HTTP request to http://localhost/oauth/recover-password/some-random-token containing an email and new password field.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].