Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qirolab/laravel-passport-oauth2-example
Laravel Passport OAuth2 Tutorial:
https://github.com/qirolab/laravel-passport-oauth2-example
laravel laravel-passport laravel-tutorial oauth2
Last synced: 3 days ago
JSON representation
Laravel Passport OAuth2 Tutorial:
- Host: GitHub
- URL: https://github.com/qirolab/laravel-passport-oauth2-example
- Owner: qirolab
- Created: 2020-07-04T08:28:35.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-30T16:03:42.000Z (almost 3 years ago)
- Last Synced: 2023-03-02T02:51:40.964Z (over 1 year ago)
- Topics: laravel, laravel-passport, laravel-tutorial, oauth2
- Language: PHP
- Homepage: https://www.youtube.com/playlist?list=PL1TrjkMQ8UbWqLEiPjsmuoTJNLKbcsYce
- Size: 414 KB
- Stars: 27
- Watchers: 2
- Forks: 31
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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](https://www.youtube.com/watch?v=K7RfBgoeg48)**
2. **[Token Scopes in Laravel Passport OAuth 2.0](https://www.youtube.com/watch?v=SEVcj8r3l90)**
3. **[Refresh tokens in Laravel Passport OAuth2](https://www.youtube.com/watch?v=tT_U1gKvubM)**### 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=
OAUTH_SERVER_SECRET=
OAUTH_SERVER_REDIRECT_URI=http://client.test/oauth/callback
OAUTH_SERVER_URI=http://server.test
```