I am trying to use JWTAutnetication to create restful api.
Following code gets the request input fields
$credentials = $request->only('email', 'password');
$token = JWTAuth::attempt($credentials)
I'm not sure what the only method is returning, but I'm assuming it's an associative array. You can use php's built in md5 method. Probably something like:
$credentials['password'] = md5($credentials['password']);
If you have control over the hashing algorithm however you may consider changing to something other than md5, such as bcrypt which php also supports out of the box since 5.5 with the
password_hash function. MD5 is vulnerable to things like key collision attacks and bcrypt has some nice features such as a work factor that can make it much more difficult to brute force.