내 REST API에 대해 jwt auth가 있어야합니다. 이제는 모든 것이 잘 작동하지만 페어링 이메일/암호를 통해 토큰을 얻으려고 할 때 오류가 발생합니다. 잘못된 자격 증명입니다. 사용자 이름/암호를 사용할 때 모든 것이 정상입니다. 내 security.ymlFOSUserBundle + 이메일을 통한 LexixJWTAuthBundle 로그인
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
providers:
fos_userbundle:
id: fos_user.user_provider.username_email
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
api_doc:
pattern: ^/api/doc
anonymous: true
security: false
login:
pattern: ^/login
stateless: true
anonymous: true
form_login:
check_path: /login
username_parameter: username
password_parameter: password
provider: fos_userbundle
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
require_previous_session: false
api:
pattern: ^/api
stateless: true
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
password:
pattern: ^/user/passwords
anonymous: true
security: false
access_control:
- { path: ^/user/passwords, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
config.yml
lexik_jwt_authentication:
private_key_path: '%jwt_private_key_path%'
public_key_path: '%jwt_public_key_path%'
pass_phrase: '%jwt_key_pass_phrase%'
token_ttl: '%jwt_token_ttl%'
user_identity_field: email
당신은 아마'username_parameter 변경 시도해 봤어 : 이메일 username'를? – kunicmarko20
@MarkoKunic 시도했지만 라벨이 붙어 있습니다. 나는'username_parameter : test'를 쓸 수 있지만 사용자 이름은 사용할 수 있습니다. ( –
아마도 시도해보십시오. https://stackoverflow.com/a/21064627 – kunicmarko20