vdomah / oc-jwtauth

JWTAuth plugin for October CMS wich provides token based authentication
MIT License
27 stars 20 forks source link

{ "error": "token_not_provided" } with OC v2 #23

Open chrisvidal opened 3 years ago

chrisvidal commented 3 years ago

I managed to login and get a token but can't do anything else,

with this from the readme in my routes.php

Route::get('test', function (\Request $request) {
                    return response()->json(('The test was successful'));
                 })->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');

sending the Bearer token with postman and receiving this

{
    "error": "token_not_provided"
}

any idea what I am missing?

fabio-coderun commented 2 years ago

You need send with "param" in your Postman, like: token: {token}

huynhnamegal commented 2 years ago

I managed to login and get a token but can't do anything else,

with this from the readme in my routes.php

Route::get('test', function (\Request $request) {
                    return response()->json(('The test was successful'));
                 })->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');

sending the Bearer token with postman and receiving this

{
    "error": "token_not_provided"
}

any idea what I am missing?

You should add this code in your .htaccess file

RewriteEngine On

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

I hope I can help you