Routes and Middleware for Using OAuth2 Server within a Slim Framework API

Overview

Chadicus\Slim\OAuth2

Latest Stable Version Latest Unstable Version License

Total Downloads Daily Downloads Monthly Downloads

A collection of OAuth2 Server routes, middleware and utilities for use within a Slim 3 Framework API

Requirements

Chadicus\Slim\OAuth2 requires PHP 5.6 (or later).

Composer

To add the library as a local, per-project dependency use Composer! Simply add a dependency on chadicus/slim-oauth2 to your project's composer.json file such as:

composer require chadicus/slim-oauth2

Components

This package is a metapackage aggregating the following components:

Examples

Examples can be found in the examples folder.

Community

Gitter

Comments
  • 401 Unauthorized

    401 Unauthorized

    When i tried to Curl Authorization

    AS you mentionded in Readme with changing in access code sure

    curl -H 'Authorization: Bearer c859d2c9eec4800a6277671eba72a5a6f54f8693' http://localhost:8888/books

    it returns , 401 Unauthorized

    ffff

    opened by abunour22 11
  • The grant type was not specified in the request

    The grant type was not specified in the request

    Hi,

    I am trying to figure out your setup - it looks awesome; but I am overseeing something! The thing I am stuck on is:

    { "error": "invalid_request" "error_description": "The grant type was not specified in the request" }

    When calling: http://localhost/cheapp/index.php/token from the advanced rest client with payload: client_id=librarian&client_secret=secret&grant_type=client_credentials and header: Accept: application/json

    It keeps throwing that nasty: "error": "invalid_request"

    probably had something to do with my setup .. database creation was not done by running some script but by finding the create tables in the code and running them. Should I have used composer for this in some way? Could only find some test code that hit this - so how does this work?

    opened by arnokoehler 9
  • granttype should not be null

    granttype should not be null

    curl -X POST -d client_id=librarian -d client_secret=secret -d grant_type=client_credentials http://test.com/token

    produce

    {"error":"unsupported_grant_type","error_description":"Grant type "client_credentials" not supported"}

    if $storage->setClientDetails('librarian', 'secret', null, null, 'bookCreate'); used then it is not possible to use the curl request like in your sample said.

    I have tried it with grant_type client_credentials also $storage->setClientDetails('librarian', 'secret', null, 'client_credentials', 'bookCreate'); without success.

    opened by Kenterfie 6
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 1
  • Cannot render template

    Cannot render template

    I integrated your implementation into my system and I cannot render the authorization template form. The error message and trace is as follows:

    Details Type: RuntimeException Message: View cannot render authorize.phtml because the template does not exist File: C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\View.php Line: 272

    Trace

    #0 C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\View.php(255): Slim\View->render('authorize.phtml', NULL)
    #1 C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\View.php(243): Slim\View->fetch('authorize.phtml', NULL)
    #2 C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\Slim.php(757): Slim\View->display('authorize.phtml')
    #3 C:\xampp\htdocs\api-fmis\v2\vendor\chadicus\slim-oauth2-routes\src\Authorize.php(65): Slim\Slim->render('authorize.phtml', Array)
    #4 [internal function]: Chadicus\Slim\OAuth2\Routes\Authorize->__invoke()
    #5 C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\Route.php(468): call_user_func_array(Object(Chadicus\Slim\OAuth2\Routes\Authorize), Array)
    #6 C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\Slim.php(1357): Slim\Route->dispatch()
    #7 C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\Middleware\Flash.php(85): Slim\Slim->call()
    #8 C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\Middleware\MethodOverride.php(92): Slim\Middleware\Flash->call()
    #9 C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
    #10 C:\xampp\htdocs\api-fmis\v2\vendor\slim\slim\Slim\Slim.php(1302): Slim\Middleware\PrettyExceptions->call()
    #11 C:\xampp\htdocs\api-fmis\v2\index.php(14183): Slim\Slim->run()
    #12 {main}
    
    opened by earllapura 1
  • Update copyright

    Update copyright

    This package is a meta-package, declaring components as dependencies. These are listed below, with links to each repository; most issues and pull requests rightfully belong against the individual components and should be made accordingly.

    If you have a pull request for the meta-package please remove the above portion and use the template below.

    Fixes # .

    What does this PR do?

    Checklist

    • [ ] Pull request contains a clear definition of changes
    • [ ] Relevant documentation produced and/or updated
    opened by chadicus 0
  • unexpected return values

    unexpected return values

    I have used your samples to test your oauth2 middleware and found some problems. One of them is that return value isn't like desired.

    Here are a sample method $app->get('/test', $authorization, function() use ($app) { $app->contentType('application/json'); $app->response->setBody(json_encode(array("status" => "success"))); });

    Without correct authorization, the response is still the same. only the return code is 403 instead to 200. Or is it intend to check the authorization in function again? {"status":"success"}

    opened by Kenterfie 0
  • Issue trying to link slim+oauth2+facebook login

    Issue trying to link slim+oauth2+facebook login

    I am not sure which dependency would be best to put this but it could make a good example.

    I have a API which is secured using this library, all well and good if user exists in the oauth users table, issue comes when I want to auth a user via social login which will be for an app I am developing.

    1. tell user to go to FB auth
    2. user auths request and is redirected back to API (or just gets the return code)
    3. return code is supplied to API and I use Facebook SDK to confirm its all good and register user if does not already exist
    4. now problem is how do I return an access token to the client based on the user in question that has been validated via social login.

    In a session based system all is good but the api should be stateless, rather relying on oauth tokens. This is something that seems to be lacking in the docs.

    help wanted 
    opened by tsmgeek 0
Releases(v3.1.2)
Owner
Chad Gray
Creating awesome PHP applications one refactor at a time.
Chad Gray
StartZ oauth2-etsy compatible League of PHP OAuth2

Etsy Provider for OAuth 2.0 Client This package provides Etsy OAuth 2.0 support for the PHP League's OAuth 2.0 Client. Requirements The following vers

StartZ 2 Nov 10, 2022
Aplicação criada com Slim Framework com objetivo de criar autenticação com JWT e aprender sobre o framework Slim

Slim JWT App Essa aplicação tem como foco o aprendizado do Framework Slim e também a utilização de JWT. Como rodar a Aplicação A aplicação está config

Nicolas Pereira 9 Oct 4, 2022
Laravel Passport is an OAuth2 server and API authentication package that is simple and enjoyable to use

Introduction Laravel Passport is an OAuth2 server and API authentication package that is simple and enjoyable to use. Official Documentation Documenta

The Laravel Framework 3.1k Dec 31, 2022
This is a basic Oauth2 authorization/authentication server implemented using Mezzio.

Mezzio-OAuth2-Authorization-Authentication-Server This is a basic OAuth2 authorization/authentication server implemented using Mezzio. I have found so

null 1 Nov 15, 2022
Slim Auth is an authorization and authentication library for the Slim Framework.

Slim Auth is an authorization and authentication library for the Slim Framework. Authentication is provided by the Zend Framework Zend\Authentication component, and authorization by the Zend Framework Zend\Permissions\Acl component.

Jeremy Kendall 246 Dec 16, 2022
Static utilitiy classes to bridge PSR-7 http messages to OAuth2 Server requests and responses.

Static utilitiy classes to bridge PSR-7 http messages to OAuth2 Server requests and responses. While this libray is entended for use with Slim 3, it should work with any PSR-7 compatible framework.

Chad Gray 18 Jul 12, 2021
documentation for the oauth2-server-php library

OAuth2 Server PHP Documentation This repository hosts the documentation for the oauth2-server-php library. All submissions are welcome! To submit a ch

Brent Shaffer 227 Nov 24, 2022
A plugin for implementing an OAuth2 server in CakePHP 3

OAuth2 Server for CakePHP 3 A plugin for implementing an OAuth2 server in CakePHP 3. Built on top of the PHP League's OAuth2 Server. Currently we supp

uAfrica Technologies (Pty) Ltd 50 Oct 28, 2022
A demo application for running an OAuth2 server

OAuth2 Demo PHP This application is designed to demo the workflow between OAuth2.0 Clients and Servers. If this is your first time here, try experimen

Brent Shaffer 738 Dec 16, 2022
OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.

HWIOAuthBundle The HWIOAuthBundle adds support for authenticating users via OAuth1.0a or OAuth2 in Symfony. Note: this bundle adds easy way to impleme

Hardware Info 2.2k Dec 30, 2022
Magic admin PHP SDK makes it easy to leverage Decentralized ID tokens to protect routes and restricted resources for your application.

Magic Admin PHP SDK The Magic Admin PHP SDK provides convenient ways for developers to interact with Magic API endpoints and an array of utilities to

magiclabs 17 Jun 26, 2022
:atom: Social (OAuth1\OAuth2\OpenID\OpenIDConnect) sign with PHP :shipit:

SocialConnect Auth Getting Started :: Documentation :: Demo Open source social sign on PHP. Connect your application(s) with social network(s). Code e

SocialConnect 518 Dec 28, 2022
:atom: Social (OAuth1\OAuth2\OpenID\OpenIDConnect) sign with PHP :shipit:

SocialConnect Auth Getting Started :: Documentation :: Demo Open source social sign on PHP. Connect your application(s) with social network(s). Code e

SocialConnect 458 Apr 1, 2021
:octocat: Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.

Socialite Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, You can easily use it in any PHP project. 中文文档 This tool no

安正超 1.2k Dec 22, 2022
Cliente OAuth2 para Gov.br

Cliente OAuth2 para Gov.br Este pacote fornece suporte OAuth 2.0 para Gov.br usando a biblioteca cliente do League PHP. Requisitos Versões suportadas

Breno Roosevelt 11 Dec 27, 2022
EvaOAuth provides a standard interface for OAuth1.0(a) / OAuth2.0 client authorization, it is easy to integrate with any PHP project by very few lines code.

EvaOAuth EvaOAuth provides a standard interface for OAuth1.0 / OAuth2.0 client authorization, it is easy to integrate with any PHP project by very few

AlloVince 256 Nov 16, 2022
EvaOAuth provides a standard interface for OAuth1.0(a) / OAuth2.0 client authorization, it is easy to integrate with any PHP project by very few lines code.

EvaOAuth EvaOAuth provides a standard interface for OAuth1.0 / OAuth2.0 client authorization, it is easy to integrate with any PHP project by very few

AlloVince 261 Jan 17, 2022
This plugin integrates OAuth2 functionality into Guzzle Bundle

Guzzle Bundle OAuth2 Plugin This plugin integrates OAuth2 functionality into Guzzle Bundle, a bundle for building RESTful web service clients. Prerequ

Vlad Gregurco 12 Oct 30, 2022