Question: I am using the Evernote Cloud SDK for PHP, which can be found [here](https://github.com/evernote/evernote-cloud-sdk-php).

In my code, I am attempting to something akin to their sample OAuth (found [here](https://github.com/evernote/evernote-cloud-sdk-php/blob/master/sample/oauth/index.php)), 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: <https://sandbox.evernote.com/OAuth.action?oauth_token=token>"

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?

Answer: 
After the `header()` function is called, you should kill the request with `die;` or `exit;` and not output anything on the page. after your `->authorize()` call try adding that in. The other thing it could be is that headers have already been sent, so this isn't "actually" being sent to the browser.

Usually what it is that the header doesn't fully send and Laravel continues doing stuff after your method is called that could corrupt this header or override it and cause an issue. so calling `exit;` or `die;` right after the header is set, you skip all of the extraneous overhead that Laravel offers by default.
try laravel redirect function.

redirect()

you can pass in a full url