David
David

Reputation: 569

Insecure use of middleware over HTTP denied by configuration /tuupola/slim-jwt-auth

I'm using JWT token in my PHP Slim 4 framework. The code is working fine on local machine but when I push the code to google cloud, I'm getting error as Insecure use of middleware over HTTP denied by configuration.

Attaching screenshot of the error log :

enter image description here

Below is my JWT Config:

<?php
$ignoreUrl = "";

$app->add(new Tuupola\Middleware\JwtAuthentication([
    "header" => "X-Token",
    "regexp" => "/(.*)/",
    "path" => "/public", 
    "secure" => true,
    "secret" => "123456789",
    "algorithm" => ["HS256"],
    "ignore" => [
        $ignoreUrl."/public/account/login", 
        $ignoreUrl."/public/account/logout"
    ],
    "error" => function ($response, $arguments) {
        $data["status"] = false;
        $data["message"] = $arguments["message"];
        return $response
            ->withHeader("Content-Type", "application/json")
            ->getBody()->write(json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
    }
]));

Tried a lot for the solution but nothing is working. Can you please suggest what's wrong in my code. Thank you in advance

Upvotes: 0

Views: 652

Answers (1)

Bibin_Francis
Bibin_Francis

Reputation: 1

set, "secure" => false,

This will solve the issue. However, it is not recommended for use in live servers.

Upvotes: 0

Related Questions