project skeleton-lumen-oauth2
Lumen 5.2 and OAuth2
douglaszuqueto/skeleton-lumen-oauth2
Lumen 5.2 and OAuth2
- Saturday, July 16, 2016
- by douglaszuqueto
- Repository
- 1 Watchers
- 0 Stars
- 7 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
Simples arquitetura utilizando Lumen 5.2 e OAuth2
InstalaĆ§Ć£o e ConfiguraĆ§Ć£o
- Crie o projeto utilizando o composer: composer create-project douglaszuqueto/skeleton-lumen-oauth2
- Entre na pasta do projeto criado: cd skeleton-lumen-oauth2
- Crie o arquivo .env: cp .env.example .env e configure o arquivo de acordo com suas configuraƧƵes
- Execute as migrations: php artisan migrate
-
No seu banco de dados:, (*1)
- VƔ na tabela users, e crie seu usuƔrio
- VĆ” na tabela oauth_clients e crie um cliente. Veja no exemplo abaixo:
id: app,
secret: secret
name: lumen_oauth2
Rodando o Projeto
- Rode o projeto usando o CLI do PHP: php -S seuIP:suaPorta -t ./public
Testando
- Para testar o projeto, recomendo o uso do Postman e se baseie nos recursos relatados no tĆ³pico abaixo.
Recursos
-
GET /, (*2)
Lumen (5.2.7) (Laravel Components 5.2.*)
-
POST /oauth/access_token, (*3)
username: douglas.zuqueto@gmail.com
password: admin
client_id: app
client_secret: secret
grant_type: password
-
GET /user, (*5)
{
"error": "access_denied",
"error_description": "The resource owner or authorization server denied the request."
}
- Acessando rota /user
-
Precisa-se passar o Token no HEADER da requisiĆ§Ć£o, (*6)
Authorization: Bearer skwc3ojORUjM6zzPov0BLYTikxrOXNidyJmp2ZVQ
-
Retorno, (*7)
[
{
"id": 1,
"name": "Douglas",
"email": "douglas@.zuqueto@gmail.com",
"remember_token": null,
"created_at": "2016-06-27 04:50:03",
"updated_at": "2016-06-27 04:50:03"
}
]
dev-master
9999999-dev
Lumen 5.2 and OAuth2
Sources
Download
MIT
The Requires
The Development Requires
api
lumen
oauth2
1.0.0
1.0.0.0
Lumen 5.2 and OAuth2
Sources
Download
MIT
The Requires
The Development Requires
api
lumen
oauth2