0

I can’t figure out what’s blocking. I’ve been following the symfony documentation.

/security.yaml

security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
    Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
    # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
    # users_in_memory: { memory: null }
    app_user_provider:
        entity:
            class: App\Entity\User
            property: email
firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
    main:
        #lazy: true
        provider: app_user_provider
        json_login:
            # api_login is a route we will create below
            check_path: api_login
            #username_path: email
            #password_path: password
            #username_path: security.credentials.email
            #password_path: security.credentials.password

/controller/ApiLoginController.php

#[Route('/login', name: 'app_api_login', methods: 'POST')]
public function index(#[CurrentUser] ?User $user): Response
{
    dd($user);
}

i set the Content-Type application/json in header's request and i put in the body the json {"username": "[email protected]","password": "root"} and i post that request with postman.

I get always null as response... your help is welcome

1 Answer 1

2

Ok i change

check_path: api_login

by

check_path: app_api_login

check_path must bee same as name: 'app_api_login' omg ....

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.