samedi 26 mars 2016

header() redirect not working in my laravel app, using the Evernote cloud SDK

I am using the Evernote Cloud SDK for PHP, which can be found here.

In my code, I am attempting to something akin to their sample OAuth (found here), I have placed the code into a controller:

class OauthController extends Controller
{
    public function reqToken()
    {
        $oauthHandler = new OauthHandler(env('EVERNOTE_SANDBOX', 'true'));
        $callback = 'http://localhost/auth'; //temp
        $oauthData = $oauthHandler->authorize(env('EVERNOTE_KEY', ''), env('EVERNOTE_SECRET', ''), $callback);
    }

}

According to the Evernote Cloud SDK, the following line of code is called under authorize():

header($authorizationUrl);

I have debugged my way to seeing that this line of code does, get called, and yet my page does not get rerouted to the $authorizationUrl, which is:

"Location: http://ift.tt/1LPVbok"

I end up staying on the blank laravel page.

If it helps, here is my route:

Route::get('/auth', 'OauthController@reqToken');

I've tried looking in the docs for info on the header function, but couldn't see anything that indicates why It's messing up for me. Any ideas?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire