ManuelGil/REST-Api-with-Slim-PHP

Cannot GET lists

Opened this issue · 3 comments

Hi and thanks for the starter API.

I was able to register a new user and log in. I'm trying to GET lists but it's returning a 500 error. Here's the RAW response. Can you have a look?

Thanks!

HTTP GET http://domain/webresources/mobile_app/list/
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJoZWFkZXIiOnsiaWQiOiIzIiwidXNlciI6InRlc3RfdXNlciJ9LCJwYXlsb2FkIjp7ImlhdCI6IjIwMTgtMDQtMDYgMDE6NDY6MTkiLCJleHAiOiIyMDE4LTA0LTA2IDAzOjQ2OjE5In19.Wi31CNlssEg7bv0xAqJ7KMYUcONbGc-lbnBHb4VKKMQ
Host: domain


500 Internal Server Error
date: Fri, 06 Apr 2018 01:46:34 GMT
server: Apache/2.4.29 (Unix) PHP/7.1.14
connection: close
x-powered-by: PHP/7.1.14
content-length: 445
content-type: text/html;charset=UTF-8
<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><title>Slim Application Error</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}</style></head><body><h1>Slim Application Error</h1><p>A website error has occurred. Sorry for the temporary inconvenience.</p></body></html>

Hi @ohbiko ,

I can't reproduce this error. I need more information.

To enable the details of this specific error message to be viewable on the app. Please, replace "$app = new \Slim\App;" in line 5 of the index.php for:

$config = [
    'settings' => [
        'displayErrorDetails' => true,
    ],
];

$app = new \Slim\App($config);

Copy the new response.

I wait for you reply.

Thanks.

SHELA commented

Type: RuntimeException
Message: Insecure use of middleware over HTTP denied by configuration.
File: /vendor/tuupola/slim-jwt-auth/src/JwtAuthentication.php
Line: 110

Thanks @SHELA,

Insert "secure" => false in line 26 in the api.php file fix this issue according to the issue #81 of tuupola/slim-jwt-auth.

Please, try it and tell me the result. I wait for you reply.

Thanks you.