# Header not set to check Authorization

**URL:** <https://discourse.slimframework.com/t/header-not-set-to-check-authorization/1321>\
**Category:** Questions\
**Created:** [March 27, 2017, 8:26am UTC](https://discourse.slimframework.com/t/header-not-set-to-check-authorization/1321 "2017-03-27T08:26:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![n30nl1ght](https://avatars.discourse-cdn.com/v4/letter/n/48db29/32.png) [@n30nl1ght](https://discourse.slimframework.com/u/n30nl1ght)\
**Post date:** [March 27, 2017, 8:26am UTC](https://discourse.slimframework.com/t/header-not-set-to-check-authorization/1321/1 "2017-03-27T08:26:22Z")

</div>

When i run my script locali with xampp it works fine.  
But i uploaded the script to the server and now it cone the error that the header was not set.

XHR does not allow payloads for GET request.  
or change a method definition in settings.

Here the script in angular

```auto
$rootScope.globals = $cookies.getObject('globals') || {};
        if ($rootScope.globals.currentUser) {
            $http.defaults.headers.common['Authorization'] = 'Basic ' + $rootScope.globals.currentUser.token;
        }

```

And here the script with SlimFramework

```auto
$config['displayErrorDetails'] = true;
$config['addContentLengthHeader'] = false;
$config['determineRouteBeforeAppMiddleware'] = true;

$app = new \Slim\App(["settings" => $config]);
$container = $app->getContainer();

// This is the middleware
// It will add the Access-Control-Allow-Methods header to every request

$app->add(function ($req, $res, $next) {
    $response = $next($req, $res);
    return $response
        ->withHeader('Access-Control-Allow-Origin', 'http://tuerundraum.kbs02.ch')
        ->withHeader('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Accept, Origin, Authorization')
        ->withHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
});

$app->get('/token', function ($request, $response){
    $token = $request->getHeaderLine('Authorization');
    if($token){
        $db = new DbOperation();
        if($db->checkAuthentication($token)){
            $return = $response->withJson(["success"=> true], 200);
        } else {
            $return = $response->withJson([
                "success"=> false,
                "message"=>'Invalid token'
            ], 403);
        }
    } else {
        $return = $response->withJson([
            "success"=> false,
            "message"=>'Header not set.'
        ], 403);
    }
    return $return;
});

```

Whats my Problem?  
Everyone knows?

Thx

Updatet Post on [StackOverflow](http://stackoverflow.com/questions/43042221/header-not-set-slimframework)
