Closed uberzhilkin closed 9 years ago
Are you using apache?
If you are then #81 and this SO post should help
No, I'm using nginx with a common Laravel configuration
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300;
}
Still will read the post you mentioned - maybe it will help
oh ok.. next thing to try is the workaround described here #72
This will be part of the next release btw
@tymondesigns, this worked for me:
filters.php
App::before(function ($request) {
if(isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])){
$request->headers->set('AUTHORIZATION',$_SERVER['REDIRECT_HTTP_AUTHORIZATION']);
}
});
Now I'm able to pass the token from my mobile app. Thanks a lot!
Hello, this is my first issue at GitHub, sorry for any mistakes. Didn't find the exact problem in open/closed issues so decided to start a new one.
My setup is Laravel 4.2 and JWTAuth 0.4.3. I'm building an API for a mobile app and I've decided to use tokens for authenification. The scenario is simple: first, the app provides user email/password pair (and the app key) to get the token. Next, the app addresses the user_info URL providing the token (and app_key again) to retrieve some user-related information.
The whole thing works abosultely fine through the GET-methods. I've created a test user with email "test@test.test" and password "testtesttest". The test app-key is "secret" and I manage to get the token by calling:
_http://anylanguage.ru:1488/api/user_auth?email=test@test.test&password=testtesttest&app_key=secret_
Next, I provide the token to user_info URL: _http://anylanguage.ru:1488/api/user_info?app_key=secret&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJzdWIiOiIxNiIsImlzcyI6Imh0dHA6XC9cL2FueWxhbmd1YWdlLnJ1OjE0ODhcL2FwaVwvdXNlcl9hdXRoIiwiaWF0IjoiMTQzMDgyMjQ4NSIsImV4cCI6IjE0MzA4MjYwODUiLCJuYmYiOiIxNDMwODIyNDg1IiwianRpIjoiMDNmOWY5YjQ5NjBkOTlkN2IzZGE1YWNjYzIzNDRhM2UifQ.OTk3MjFlYWQ5YzFlYmUxYjU1MjIyMWQ2ZDVhOTZlNzZkZDU1YmM4ODg5NWQ2MWUyOTgwNGE1N2ZjY2U4OWRkMw_
I get stuck with the POST-method, though. I use the hurl.it to get the token and it is generated just fine:
Yet when I try to pass the token to user_info URL I get the "token absent" error:
When I try to pass the token through header parameters it throws a different "token invalid" exception.
I catch all JWT-exceptions globally at global.php:
All the requests to user_info URL are filtered for valid token presence like this: routes.php
filters.php
You may notice the strange line "JWTAuth::setToken( Input::get( 'token' ) );" and the commented "dd( JWTAuth::getToken() );" one. These were to assure the token stored in JWTAuth is the one I pass through the POST-method. The dd() call prints exactly the same token I pass through POST-method (wherther I call setToken() before or not) so I have now I'm really stuck here wihtout an idea where to move forward. Would be grateful for the answer if it is my error or the package's one.
Thank you!