mardi 11 juillet 2017

header location doesnt redirect from class php method

I am making an authentication single sign on using laravel passport, and i have already followed the laravel guide

since my team project doesn't use laravel framework only, so i would like to create a flexible class

a simple code

use GuzzleHttp\Psr7;
class Client {
    public function auth(){
        $config = [
            'client_id' => $this->getClientId(),
            'redirect_uri' => $this->getRedirectUri(),
            'response_type' => 'code',
            'scope' => '',
        ];

        $query = http_build_query(
            $config
        );

        $url = "http://localhost/server-site/oauth/authorize?".$query;
        header( "Location: {$url}" );
    }
}

In my laravel controller

$client = new Client();
$client->setClientId(4);
$client->setRedirectUri("http://localhost/client-site/test/test_login");
$client->auth();

After that i could not redirect to the server-site this code working properly in my codeigniter framework.

But in laravel framework, when i tried dd($client) after the auth() i could redirect to the server-site

Is there anyone know how to fix this, or if there are another method to redirect please tell me

thank you (:



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2tcFEpL
via IFTTT

Aucun commentaire:

Enregistrer un commentaire