我想jwtauthentificationbundle整合與fosuserbundle,所以我可以爲我的REST API的令牌,但是當我跟郵遞員測試: 後http://127.0.0.1:8000/api/login_check 這是我的security.yml:LexikJWTAuthentificationBundle {「代碼」:401,「消息」:「壞憑據」}
安全: 編碼器: FOS \ UserBundle \型號\的UserInterface:bcrypt
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: ^/api/login
stateless: true
anonymous: true
form_login:
check_path: /api/login_check
username_parameter: username
password_parameter: password
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
main:
anonymous: ~
access_control:
- { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
,這是我的routing.yml:
app:
resource: '@AppBundle/Controller/'
type: annotation
app_api:
resource: '@AppBundle/Controller/Api'
type: annotation
api_login_check: 路徑:/ API/login_check
NelmioApiDocBundle: 資源: 「@ NelmioApiDocBundle /資源/配置/ routing.yml中」 前綴:/ API/DOC
fos_user: 資源:「@ FOSUserBundle/Resources/config/routing/all.xml」
任何幫助?
我發現anwser是了when我跟郵遞員測試它,我必須 頭髮送數據:內容類型application/x-WWW窗體-urlencoded –