Aldigin hatayi (trace) koyabilirmisin?
$app = new SlimApp;
$app->add(new TuupolaMiddlewareJwtAuthentication([
"path" => "/api", /* or ["/api", "/admin"] */
"secret" => "supersecretkeyyoushouldnotcommittogithub"
]));sunun calismasi lazim. Tuupola paketini bende kullandim bir proxy api icin. herhangi bir sorunla karsilasmadim.
Yeni sürümde çalıştıramadım hocam. Sitedeki kişinin paylaştığı kodların indirdim ve sonrasında "composer install" dedim. Tabii içerisindeki paketler vs. o tarihte oluşturulan versiyonları ile kullanmış oldum. Yarın bir deneyip yine buradan yazacağım.Slim ile geliştirmek istedim firebase daha mantıklıydı ama biraz yabancı olmam slimframeworke yönlendirdi beni. Teşekkür.
Aldigin hatayi (trace) koyabilirmisin?
$app = new SlimApp;
$app->add(new TuupolaMiddlewareJwtAuthentication([
"path" => "/api", /* or ["/api", "/admin"] */
"secret" => "supersecretkeyyoushouldnotcommittogithub"
]));sunun calismasi lazim. Tuupola paketini bende kullandim bir proxy api icin. herhangi bir sorunla karsilasmadim.
Postman ile request atıyorum ama Loading diyor hoccam. Middleware tüm kodlarım bunlar. Başka bir kütüphane mi eklenmesi gerekiyor. composer require tuupola/slim-jwt-auth ile bunu ekledim.
<?php
use SlimApp;
$app = new SlimApp;
$app->add(new TuupolaMiddlewareJwtAuthentication([
"path" => "/api", /* or ["/api", "/admin"] */
"secret" => "supersecretkeyyoushouldnotcommittogithub"
]));
?>
Bu da şu an kullandığım projenin middleware.php dosyası
$app->add(new TuupolaMiddlewareJwtAuthentication([
"path" => "/api", /* or ["/api", "/admin"] */
"attribute" => "decoded_token_data",
"secret" => "supersecretkeyyoushouldnotcommittogithub",
'secure' => false,
"algorithm" => ["HS256"],
"error" => function ($response, $arguments) {
$data["status"] = "error";
$data["message"] = $arguments["message"];
return $response
->withHeader("Content-Type", "application/json")
->write(json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
}
]));