<?php
namespace App\Helpers;

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

class CommHelper{

    public static function doTokenRequest($code){
        $tokenRequest = Request::create(
            '/oauth/token',
            'post',
            [
                'grant_type' => 'authorization_code',
                'client_id' => 1,
                'client_secret' => 'vSIqEamfwpgpgEeT73Redx5IxbrmKqTukfYpRYU2',
                'redirect_uri' => url("callback"),
                'code' => $code
            ]
        );
        $response = app()->handle($tokenRequest);
        return view('auth.token_response')->with('tokenResponse', $response->content());
    }
}