2017 © Pedro PelĆ”ez
 

project skeleton-lumen-oauth2

Lumen 5.2 and OAuth2

image

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

The README.md

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)

    • Dados De entrada
    username:       douglas.zuqueto@gmail.com
    password:       admin
    client_id:      app
    client_secret:  secret
    grant_type:     password
    
    • Dados de SaĆ­da, (*4)

      {
      "access_token": "u53O5pCKsSAlwtXfd1ies7kkC29Pj1APkyzIUvFK",
      "token_type": "Bearer",
      "expires_in": 3600
      }
      
  • GET /user, (*5)

    • Rota Bloqueada
    {
      "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"
      }
      ]
      

The Versions

16/07 2016

dev-master

9999999-dev

Lumen 5.2 and OAuth2

  Sources   Download

MIT

The Requires

 

The Development Requires

api lumen oauth2

16/07 2016

1.0.0

1.0.0.0

Lumen 5.2 and OAuth2

  Sources   Download

MIT

The Requires

 

The Development Requires

api lumen oauth2