vdomah / oc-jwtauth Goto Github PK
View Code? Open in Web Editor NEWJWTAuth plugin for October CMS wich provides token based authentication
License: MIT License
JWTAuth plugin for October CMS wich provides token based authentication
License: MIT License
Hello,
there is a way to add other data like user role in the header response , i know that i can modify directly the file route.php and add to
$user = [ 'id' => $userModel->id, 'name' => $userModel->name, 'surname' => $userModel->surname, 'username' => $userModel->username, 'email' => $userModel->email, 'is_activated' => $userModel->is_activated, ];
there is a way to extend this file , thans
Hi, I updated October to Build 431 and tried to install the plugin.
I copied the auth.php file into config/ but it doesn't seems to work.
Missing argument 1 for Illuminate\Auth\AuthManager::createDriver(),
called in {root}/vendor/laravel/framework/src/Illuminate/Support/Manager.php on line 87
and defined
{root}/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php line 16
Hy I am having this error when i run php artisan jwt:generate
In BoundMethod.php line 147:
Method Tymon\JWTAuth\Commands\JWTGenerateCommand::handle() does not exist
Thanks
Hi,
How to retrieve the User session after login?
I am building API using this plugin to handle the authentication.
How do I get the logged user session?
I tried the usual
$user = Auth::getUser();
but it does not work
thanks
Did I miss something or should we change the 'secret' in jwthauth/config/config.php?
If yes, that would be important to write into the installation file. Or ideally be done by the plugin registration method.
Actually, I don't know if this is the right place to post this error (I'll put it to the october core repo as well).
Anyhow, trying to do the authentication with the current OctoberCMS version through JWT will result into the following error:
[Fri May 17 16:51:35.315766 2019] [fcgid:warn] [pid 18049] [client 24.134.39.209:60808] mod_fcgid: stderr: PHP Fatal error: October\\Rain\\Auth\\Models\\User and Illuminate\\Auth\\Authenticatable define the same property ($rememberTokenName) in the composition of Vdomah\\JWTAuth\\Models\\User. However, the definition differs and is considered incompatible. Class was composed in /var/www/vhosts/test/htdocs/test/plugins/vdomah/jwtauth/models/User.php on line 5
What I found out was that the concurrent declarations will be found here, in the vendor directory of the OctoberCMS root folder:
vendor/october/rain/src/Auth/Models/User.php: protected $rememberTokenName = 'persist_code'; vendor/october/rain/src/Auth/Models/User.php: return $this->rememberTokenName; vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php: protected $rememberTokenName = 'remember_token'; vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php: return $this->rememberTokenName;
After changing it to "persist_code" there is no problem with authenticating anymore.
Does anyone else have that problem as well here? Or found a solution without modifying the vendor files?
How do you make the POST request with a parameter that you later call as Request::get('email')?
Do you use Postman?
Can you give an example of how the request at the client side should look like?
I've followed the plugin instructions and configured the settings.
When i try to login using cURL i always get invalid_credentials, even if's all double checked:
curl --request POST --header "Content-Type: application/json" --data '{email:"my_email_address",password:"my_password"}' https://my_server_url/api/login
{"error":"invalid_credentials"}
Is there something i'm missing?
Thanks in advance.
have an error when i update system version 443 to 446
October build - 427
User plugin version - 1.4.3
from october event log
Illuminate\Contracts\Container\BindingResolutionException: Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Auth\AuthManager in /Users/andrew/work/ocblog/vendor/laravel/framework/src/Illuminate/Container/Container.php:933
just fresh install octobercms 2.2.22 and php artisan plugin:install Rainlab.User
, php artisan plugin:install Vdomah.Jwtauth
got and error like: Class 'Tymon\JWTAuth\JWTAuth' not found
I use the following code on my own plugin:
Route::post('test', function (\Request $request) {
return response()->json(('The test was successful'));
})->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');
But when I post something to this route, it always return the status 503 Service Unavailable, and I tested \Tymon\JWTAuth\Middleware\GetUserFromToken::handle() that is never called
but when I change Route::post to Route::get, \Tymon\JWTAuth\Middleware\GetUserFromToken::handle() will call successful.
Any idea for this situation? Thanks
Hi is there a way to login using username and password , when i did it
it threw this error
{
"errors": {
"root": "Could not sign you in with those details."
}
}
Is there a possibility of changing the error key and message from the controller because I have to follow some certain format when returning a response body from the client?
Is it intentional ?
They are in the doc but not in the code. They have been removed here : f597f43
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?
I have a fresh install octobercms with Octobro/Api and was looking for a good oAuth plugin.
Unfortanetly I am getting the error Auth guard is not defined when I'm trying to login.
I am creating a login request with Postman POST request and have submitted my fields in the form-data body.
Also, can I create a user for the API only? Right now it is mixing with my customers users but I would like to restrict the API user(s) or group to the API only.
Route::post('api/test', function (\Request $request) {})->middleware('jwt.auth');
I am getting error:
Class jwt.auth does not exist
\vendor\laravel\framework\src\Illuminate\Container\Container.php
It works fine when I replace it with the value from jwtauth/plugin.php boot():
// $this->app['router']->middleware('jwt.auth', '\Tymon\JWTAuth\Middleware\GetUserFromToken');
...->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');
Any ideas?
the tymondesigns/jwt-auth 1.0.0 RC ist out can you make it compatible? :-)
Hi,
Thank you for this wonderful plugin.
My application required a rest API for frontend and backend users. This plugin provides functionality for frontend user but the same thing can be used for Backend user?
Thanks.
When I try and use the CMS tab in October, I get this error.
Undefined property: Tymon\JWTAuth\Middleware\GetUserFromToken::$isHidden
/$my_path/modules/cms/widgets/ComponentList.php line 101
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.