lundi 22 juin 2020

How to test api of JWT in Laravel?

I want to see whether the JWT Login does work. email and passwords are stored in database. When I test it through Postman it works. However, testing does give me the status code 500 which I don't know the problem. What is the missing point in the code? How can I test my api using Laravel and JWT?

public function testApiTesting()
{

    $baseURL = Config::get('app_url') . '/api/login';
    $email = Config::get('api.Email');
    $password = Config::get('api.apiPassword');

    $response = $this->json('POST', '/api/login', [
        'email' => 'berk@gmail.com',
        'password' => 'berk123'
    ]);

    $response->assertStatus(200)->assertJsonStructure([
        'access_token', 'token_type', 'expires_in'
    ]);



}

Aucun commentaire:

Enregistrer un commentaire