jwtrefreshtokenbundle更改user_identity_field symfony 5.4+ apiplatform
我正在使用:SYMFONY 5.4 + APIPLATFORM + JWTREFRESHTOKENBUNDLE 1.1
https://github.com/markitosgv/jwtrefreshtokenbundle无法更改此问题:
我试图更改yaml =>
gesdinet_jwt_refresh_token:
user_identity_field:电子邮件
user_provider:app_user_provider
我尝试在我的用户提供者(app_user_provider)entity user.php:
public函数getUserIdentifier():字符串
{
返回(字符串)$ this-> id;
}
现在,我可以获得的越好是将ID代替我的数据库中的“用户名”列中的电子邮件,但是一旦我尝试刷新令牌,我就会得到此消息=> “ 401”无效的凭据”。
我试图拥有“ ID”,而不是“电子邮件”作为User_identity_field。
有人找到了解决方案吗? 谢谢。
I am using : Symfony 5.4 + ApiPlatform + JWTRefreshTokenBundle 1.1
JWTRefreshTokenBundle => https://github.com/markitosgv/JWTRefreshTokenBundle
I need to change this parameter "user_identity_field" but there is no way to change this :
I tried to change the Yaml =>
gesdinet_jwt_refresh_token:
user_identity_field: email
user_provider: app_user_provider
I tried to modify this function in my user provider (app_user_provider) entity User.php :
public function getUserIdentifier(): string
{
return (string) $this->id;
}
Right now the better I can get is to have the ID instead of the E-mail in the user name column in my database, but as soon as I try to refresh the token, I get this message => " 401 "Invalid credentials".
I am tried to have "ID" instead of "E-MAIL" as user_identity_field.
Has anyone found a solution ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
SF 5,4+
Sf 5,4+
我认为您需要在安全性中更改App_user_provider.yaml文件:
我认为问题是:Symfony尝试使用App_USER_PROVIDER对用户进行认证,并且您遇到了冲突,因为ID在JWT中,但框架搜索了电子邮件。
为了验证您可以在:
i think you need to change the app_user_provider in the security.yaml file :
i think the problem is : symfony try to authneticate user with the app_user_provider and you have a conflict because id's are in your JWT but framework search for email.
For verify that you can check your tokens on : https://jwt.io/
Jwtrefreshtokenbundle(
gesdinet/jwt-refresh-token-bundle
)是在(lexik/jwt-authentication-bundle
),这是定义user_identity_field
配置的捆绑包:The JWTRefreshTokenBundle (
gesdinet/jwt-refresh-token-bundle
) is build upon the JWTAuthenticationBundle (lexik/jwt-authentication-bundle
), which is the bundle that defines theuser_identity_field
configuration: