我需要在控制器Symfony2中读取JWT Token,并在前端发送到$ localStorage(不是标准登录过程)。
我使用AngularJS 1.4,Symfony2.7(REST),LexikJWTAuthenticationBundle。
如何在控制器中为已登录用户读取此令牌?
(例如JWT令牌:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9.eyJleHAiOjE0NTMyODkzNzAsInVzZXJuYW1lIjoibWFjaWVqLm9zeXRla0BnbWFpbC5jb20iLCJpYXQiOiIxNDUzMjAyOTcwIn0.P8d4dDSkUk26U6voqeDxJ6RtH2sy_d1fBcB_XHx_E8AOfmQuib3E54ERIRhuhl4T7bFTzpmpOZ-K-RcpkkdjfvlsfaM1R9KRkDVHXZ1KpQs4nF1u4SZef6SorAES-d4ZSnouKLS3BRLayXtpTOLGjzaq3RpKVIAIEZtEQNvKTZBUdvCvDd2X-_UmyMAxgFShNvpw2CSLmdFys45KjfcTP9l74hsK7-l5kkkqywa-q4feIPVkLHJ-J41oU2l6jGf_KbHW4pTNFJ_6X7c-awkHRxyphrcXbtK_BlBiwOff7hOsODTZhIBh2StTnmO0jegIlKlVxsnlP652zYzf2NsqhcIz0hblknmeOZV_hit-liEXuNZy4-7Ee_Tn2bLusGOIGVnniuVFSkZIGtvoV8KJWuj7mXefmTln_rPyI04RQy9m1BW3V3h2TmEKgpK4c01p5c2wx6CCtSV0SLCcKMA2p1-fYMkOgQ0J4YrZ4nrMcRHh6P8rsb9NSnTlwmOrzoBYad7QXhl780NIh7h_MAp0aLcQNSAHtCG6CdZywoNst5bEc-rtd2MY2aL3zddrh_zPxQ-6TE05rqWQQ8fasbTj808khgybywwj4GC5AA4vaPSksEsqeuk414hmBizZUNlLEL0W4k1LzovlFuLFZwQrVBCTh1J_gKEQ0rpCMjag7gY)
答案 0 :(得分:0)
好的,我找到了: $这 - >获得( 'lexik_jwt_authentication.jwt_manager') - >创建($这 - >的getUser());