이 프로젝트는 tymon/jwt-auth
를 라라벨(Laravel) 프로젝트에 적용한 예제입니다.
이 프로젝트는 앤서블(Ansible)과 라라독(Laradock)을 사용하여 만든 개발 환경에서 개발하고 테스트하였습니다. 앤서블(Ansible)과 라라독(Laradock)으로 만든 개발 환경이 궁금하신 분은 아래의 저장소(Repository)를 확인하세요.
- dev-yakuza/laravel-devtool: https://github.com/dev-yakuza/laravel-devtool#laravel-devtool-%EC%82%AC%EC%9A%A9%EB%B2%95
위에서 소개한 저장소(Repository)에 대한 설명은 아래의 블로그를 확인하세요.
- vagrant 설치 및 사용법: https://dev-yakuza.github.io/ko/environment/vagrant-install-and-usage
- 앤서블 설치: https://dev-yakuza.github.io/ko/environment/install-ansible
- 앤서블 플레이북: https://dev-yakuza.github.io/ko/environment/ansible-playbook
- 앤서블&도커: https://dev-yakuza.github.io/ko/environment/ansible-docker
- 앤서블&라라독: https://dev-yakuza.github.io/ko/environment/ansible-laradock
- 앤서블&라라벨: https://dev-yakuza.github.io/ko/environment/ansible-laravel
이 저장소(Repository)를 복사(Clone)합니다.
git clone https://github.com/dev-yakuza/laravel-jwt-exercise.git
프로젝트에 필요한 미들웨어(Middleware)를 설치합니다.
composer install
프로젝트의 환경 파일을 복사한 후 데이터베이스(Database)와 연결합니다. (데이터베이스와의 연결은 블로그를 참고해 주세요. - 앤서블&라라벨)
cp .env.example .env
라라벨(Laravel)의 비밀키(Secret Key)를 생성합니다.
php artisan key:generate
jwt 인증 시스템의 비밀키(Secret Key)를 생성합니다.
php artisan jwt:secret
라라벨(Laravel)의 사용자 테이블(User Table)을 생성합니다.
php artisan migrate
jwt의 사용방법은 아래에 내용을 참고하세요.
이 저장소(Repository)를 생성하면서 만든 블로그가 있습니다. jwt 미들웨어(Middleware) 설치나 사용 방법에 대해서는 아래에 블로그를 확인해 주세요.
- jwt 설치 및 설정: https://dev-yakuza.github.io/ko/laravel/jwt/
- jwt:회원가입: https://dev-yakuza.github.io/ko/laravel/jwt-signup/
- jwt:로그인: https://dev-yakuza.github.io/ko/laravel/jwt-signin/
- jwt:사용자 정보: https://dev-yakuza.github.io/ko/laravel/jwt-user-info/
- jwt:토큰 갱신: https://dev-yakuza.github.io/ko/laravel/jwt-refresh-token/
- jwt:로그아웃: https://dev-yakuza.github.io/ko/laravel/jwt-logout/
このプロジェクトはtymon/jwt-auth
をララベル(Laravel)プロジェクトに適用した例です。
このプロジェクトはアンシブル(Ansible)とLaradock)を使って作った開発環境の上で開発してテストしました。アンシブル(Ansible)とLaradockで作った開発環境が知りたい方は下のリポジトリ(Repository)を確認してください。
- dev-yakuza/laravel-devtool: https://github.com/dev-yakuza/laravel-devtool#laravel-devtool%E4%BD%BF%E3%81%84%E6%96%B9
上に紹介したリポジトリ(Repository)については下記のブログを確認してください。
- vagrantインストールや使い方: https://dev-yakuza.github.io/environment/vagrant-install-and-usage
- アンシブルインストール: https://dev-yakuza.github.io/environment/install-ansible
- アンシブルプレイブック: https://dev-yakuza.github.io/environment/ansible-playbook
- アンシブル&ドッカー: https://dev-yakuza.github.io/environment/ansible-docker
- アンシブル&Laradock: https://dev-yakuza.github.io/environment/ansible-laradock
- アンシブル&ララベル: https://dev-yakuza.github.io/environment/ansible-laravel
このリポジトリ(Repository)をコピー(Clone)します。
git clone https://github.com/dev-yakuza/laravel-jwt-exercise.git
プロジェクトへ必要なミドルウェア(Middleware)をインストールします。
composer install
プロジェクトの環境ファイルをコピーした後データベース(Database)と連携します。(データベースとの連携についてはブログを確認してください。 - アンシブル&ララベル)
cp .env.example .env
ララベル(Laravel)の秘密キー(Secret Key)を生成します。
php artisan key:generate
jwt認証システムの秘密キー(Secret Key)を生成します。
php artisan jwt:secret
ララベル(Laravel)のユーザテーブル(User Table)を生成します。
php artisan migrate
jwtの使い方は下を確認してください。
このリポジトリ(Repository)を生成しながら作ったブログがあります。jwtミドルウェア(Middleware)のインストールや使い方は下記のブログを参考してください。
- jwtインストールや設定: https://dev-yakuza.github.io/laravel/jwt/
- jwt:会員登録: https://dev-yakuza.github.io/laravel/jwt-signup/
- jwt:ログイン: https://dev-yakuza.github.io/laravel/jwt-signin/
- jwt:ユーザ情報: https://dev-yakuza.github.io/laravel/jwt-user-info/
- jwt:トークン更新: https://dev-yakuza.github.io/laravel/jwt-refresh-token/
- jwt:ログアウト: https://dev-yakuza.github.io/laravel/jwt-logout/
this project is an example to apply tymon/jwt-auth
to Laravel.
this project was developed and tested on the development environment which is consisted of Ansible and Laradock. if you want to know how to make the development environment by Ansible and Laradock, see below repository.
- dev-yakuza/laravel-devtool: https://github.com/dev-yakuza/laravel-devtool#laravel-devtool-%EC%82%AC%EC%9A%A9%EB%B2%95
if you want to know details about above repository, see below blogs.
- vagrant installation and usage: https://dev-yakuza.github.io/en/environment/vagrant-install-and-usage
- Ansible installation: https://dev-yakuza.github.io/en/environment/install-ansible
- Ansible Playbook: https://dev-yakuza.github.io/en/environment/ansible-playbook
- Ansible&Docker: https://dev-yakuza.github.io/en/environment/ansible-docker
- Ansible&Laradock: https://dev-yakuza.github.io/en/environment/ansible-laradock
- Ansible&Laravel: https://dev-yakuza.github.io/en/environment/ansible-laravel
first, clone this repository.
git clone https://github.com/dev-yakuza/laravel-jwt-exercise.git
install middlewares those this project requires.
composer install
copy the project environment file and connect the database. (if you want to know how to connect database, see the blog post. - Ansible&Laravel)
cp .env.example .env
create the secret key of Laravel.
php artisan key:generate
create the secret key of jwt authentication system.
php artisan jwt:secret
create the user table of Laravel.
php artisan migrate
see below about how to use jwt.
we've made blogs when we're creating this repository. if you want to know how to install jwt middleware or how to use jwt, see below blog posts.
- jwt installation&settings: https://dev-yakuza.github.io/en/laravel/jwt/
- jwt:signup: https://dev-yakuza.github.io/en/laravel/jwt-signup/
- jwt:signin: https://dev-yakuza.github.io/en/laravel/jwt-signin/
- jwt:user information: https://dev-yakuza.github.io/en/laravel/jwt-user-info/
- jwt:refresh token: https://dev-yakuza.github.io/en/laravel/jwt-refresh-token/
- jwt:logout: https://dev-yakuza.github.io/en/laravel/jwt-logout/