Skip to content

harryosmar/plugin-http-client-passport-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plugin Http Client for oauth2 passport laravel

Composer plugin for Project Survey. Contains httpclient libraries to do request to server api survey

Installation

Add this composer.json file

{
    "require": {
        "harryosmar/plugin-http-client-passport-laravel": "^1.0"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
        ]
    },
    "extra": {
        "incenteev-parameters": {
            "file": "config/apiClient.yml",
            "dist-file": "vendor/harryosmar/plugin-http-client-passport-laravel/config/apiClient.yml.dist",
            "parameter-key": "parameters"
        }
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "[email protected]:harryosmar/plugin-http-client-passport-laravel.git"
        }
    ]
}

Then running

$ composer install

Install in Laravel 5

Add this following service provider to your config/app.php file.

PluginHttpClientPassportLaravel\Laravel\HttpClientPassportServiceProvider

Using Service Container

This approach can be used for all PHP framework

/** @var \PluginHttpClientPassportLaravel\Client $httpClientPassportLaravel */
$httpClientPassportLaravel =  ServiceContainer::getInstance()
    ->getContainer()
    ->get('HttpClientPassportLaravel');

# example for request post
$httpClientPassportLaravel
    ->action('oauth/token')
    ->body([
        'grant_type'  => 'password',
        'client_id'  => 1,
        'client_secret'  => 'xxxx',
        'redirect_uri'  => 'http//localhost/auth/callback',
        'username'  => 'username',
        'password'  => 'secret',
        'scope'  => 'scope1 scope2',
    ])
    ->post();

About

Submitting bugs and feature requests

Harry Osmar Sitohang - [email protected] - https://github.com/harryosmar
See also the list of contributors which participated in this project.

About

plugin http client for oauth2 server laravel passport

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages