Giter Site home page Giter Site logo

emrancu-practice / laravel-passport-oauth2-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qirolab/laravel-passport-oauth2-example

0.0 0.0 0.0 424 KB

Laravel Passport OAuth2 Tutorial:

Home Page: https://www.youtube.com/playlist?list=PL1TrjkMQ8UbWqLEiPjsmuoTJNLKbcsYce

PHP 70.29% HTML 18.01% Vue 11.71%

laravel-passport-oauth2-example's Introduction

Laravel Passport OAuth2 Example

Laravel Passport provides a complete OAuth2 implementation out of the box.That comes with database migrations, routes, and middleware to create an OAuth 2.0 server that will return access tokens to allow access to server resources by other third-party apps. It uses the League OAuth2 Server package as a dependency but very easy-to-learn, and easy-to-implement.

Tutorials

  1. Laravel Passport OAuth2 Server Implementation
  2. Token Scopes in Laravel Passport OAuth 2.0
  3. Refresh tokens in Laravel Passport OAuth2

OAuth Server Setup

First, you need to clone this repository, and navigate to server and install composer dependencies.

cd server
composer install

After installing composer dependencies, add your database credentials in .env file and then run migrations.

php artisan migrate

Make sure to create virtual host for server app for example server.test that you will need to use in client app.

Client App Setup

Now, navigate to client app and install composer dependencies.

cd server
composer install

Next, add your database credentials in .env file and then run migrations.

php artisan migrate

Next, create virtual host for client app for example client.test that you will need to define redirect uri for OAuth2 authorization callback.

Usage

In the server app, navigate to http://server.test/developers route. And here create new OAuth client. It will generate client ID and secret.

Next, in the client app, add following configurations in the .env file and it is ready to use.

OAUTH_SERVER_ID=<client-id>
OAUTH_SERVER_SECRET=<client=secret>
OAUTH_SERVER_REDIRECT_URI=http://client.test/oauth/callback
OAUTH_SERVER_URI=http://server.test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.