Closed selfee-jp closed 1 year ago
Yes Slim 4 is supported. Check your logs and full response headers for errors. Also if you are setting a basepath with $app->setBasePath("/api");
it means you should make a request to /api/user
instead of /user
.
@tuupola Yes. No errors. Of course, you are making a request to "/api/user".
request
Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate
Accept-Language: ja,en-US;q=0.9,en;q=0.8
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhb....
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 39
Content-Type: application/json
Host: 192.168.10.2
Origin: http://localhost:8080
Pragma: no-cache
Referer: http://localhost:8080/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
response
Access-Control-Allow-Headers: Origin, Content-Type, Authorization
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin: *
Cache-Control: no-store, no-cache, must-revalidate
Connection: Keep-Alive
Content-Length: 0
Content-Type: application/json; charset=utf-8
Date: Wed, 19 Apr 2023 07:13:46 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive: timeout=5, max=99
Pragma: no-cache
Server: Apache/2.4.53 (Win64) OpenSSL/1.1.1n PHP/8.1.6
Set-Cookie: PHPSESSID=n6pnhjjnjo61h9her8okanrik3; path=/
X-Powered-By: PHP/8.1.6
I can't confirm the operation, so it seems faster to make my own. thank you very much.
try {
$decoded = JWT::decode($jwt, $secret_key, array('HS512'));
print_r($decoded->data);
} catch (\Exception $e) {
echo 'error: '.$e->getMessage();
}
Hello. The API is created in Slim4. In "/api/login", after issuing JWT, "/user" is not executed. If I remove the middleware, it works. "200 OK" is returned, but there is no content. The JwtAuthentication error callback does not seem to work either.