简体   繁体   English

传递参数HWIOAuthbundle symfony2

[英]Pass parameter HWIOAuthbundle symfony2

I'm trying to pass a GET parameter from my Facebook and Google login button, that I've set up using HWIOAuthbundle. 我正在尝试从我的Facebook和Google登录按钮传递一个GET参数,我已经使用HWIOAuthbundle进行了设置。 I've looked at this question: To path the parameter to OAuth facebook login by symfony2/HWIOAuthBundle , however I didn't quite understand how he managed to get it working. 我已经看过这个问题了: 要通过symfony2 / HWIOAuthBundle将参数路径输入OAuth facebook登录 ,但是我不太明白他是如何设法让它工作的。 He mentions using referer, which I don't anything about - and I don't have enough reputation to post a comment on that question... 他提到使用引用者,我对此一无所知 - 而且我没有足够的声誉来发表对该问题的评论......

I was thinking something like this: 我在想这样的事情:

<a href="{{ path('google_login',{'datakey':1}) }}">Link</a>

But how do I retrieve it in my FOSUBUserProvider? 但是如何在我的FOSUBUserProvider中检索它? I appreciate all help! 我感谢所有的帮助!

I finally managed to get it working. 我终于设法让它工作了。 However, I am not sure it is the best way to do it. 但是,我不确定这是最好的方法。 It's a quick fix until I find a more proper solution. 这是一个快速解决方案,直到我找到一个更合适的解决方案。

When someone enters my website with the datakey variable as a $_GET parameter, I set a cookie with the value. 当有人使用datakey变量作为$ _GET参数进入我的网站时,我设置了一个带有该值的cookie。 When the user logs in, the FOSUBUserProvider checks whether the datakey cookie is set; 当用户登录时,FOSUBUserProvider会检查datakey cookie是否已设置; if it is, it will do its thing. 如果是的话,它会做它的事情。

This is the best I can do for now, as I haven't managed to succeed sending parameters through the hwioauthbundle and into my FOSUBUserProvider. 这是我现在能做的最好的事情,因为我没有成功通过hwioauthbundle和我的FOSUBUserProvider发送参数。

If someone finds a better solution, let me know! 如果有人找到更好的解决方案,请告诉我!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM