0
I am doing a login system with Laravel using JWT, however I need to pass 3 parameters, being them an identifier, user and password. I can get those parameters, but I can’t authenticate with the bank. It checks the user and password, but this first parameter (the identifier, which is required to mount the menu) it does not check. Has anyone used JWT passing 3 parameters? How can I check these 3 parameters?
I’m using https://github.com/tymondesigns/jwt-auth . Follow below excerpt from my code:
public function authenticateJson(Request $request) {
// pega as credenciais para o login
$credentials = $request->only('login', 'password');
$customClaims = ['ep_chave' => $request->only('ep_chave')];
try {
// verifica o login e cria o token
if (! $token = JWTAuth::attempt($credentials, $customClaims)) {
return response()->json(['error' => 'Login ou senha inválidos'], 401);
}
} catch (JWTException $e) {
//Erro para Criar o token
return response()->json(['error' => 'Não foi possível criar o token'], 500);
}
// Caso tudo ok retorna o token
return response()->json(compact('token'));
}
It creates the Token?
– novic
Yes, creates the token. If I take the ep_key field, it even logs in normally, but does not check if the ep_key matches what is in the database.
– Alberto Aguiar
I understand, if you have to check otherwise Alberto
– novic