<?php

namespace App\Http\Controllers\API\Auth;

use Illuminate\Support\Facades\Route;
use Illuminate\Http\Request;


trait IssueTokenTraitController
{
    public function issueToken(Request $request, $grantType, $scope = ""){

		$params = [
    		'grant_type' => $grantType,
    		'client_id' => $this->client->id,
    		'client_secret' => $this->client->secret, 
            'username' => $request->email, 		
    		'scope' => $scope
    	];

    	$request->request->add($params);

    	$proxy = Request::create('oauth/token', 'POST');

    	return Route::dispatch($proxy);

	}

}
