简体   繁体   English

具有多个域扩展的Django社会注册

[英]Django socialregistration with multiple domain extensions

i would Like to ask you for help because I'm struggling with a particular problem that i cannot resolve. 我想向您寻求帮助,因为我正在解决我无法解决的特定问题。

I'm using the django app "socialregistration" which works fine for connecting on different social platforms. 我正在使用django应用程序“ socialregistration”,可以很好地在不同的社交平台上进行连接。

The problem is that when you register an application on theses platforms you can only have on single callback and redirect_uri. 问题是,当您在这些平台上注册应用程序时,只能在单个回调和redirect_uri上使用。

Taking Facebook for example. 以Facebook为例。 What do i have to do manage all my websites with the same FB APP_ID : I don't want to create 5 apps for 5 different domain extensions. 我必须用相同的FB APP_ID管理所有网站:我不想为5个不同的域扩展创建5个应用。

When a user logs in on ".com" he has to be redirected to ".com", ".fr" must be redirect to ".fr" and so on... 用户登录“ .com”时,必须将其重定向到“ .com”,“。fr”必须重定向到“ .fr”,依此类推...

Thank you in advance! 先感谢您!

Instead of handling this in the socialregistration app or in the social network you are connecting to, you should simply handle it in your django app directly. 与其在您要连接的socialregistration应用程序或社交网络中处理,不如直接在django应用程序中处理它。 They way you could follow: 它们使您可以遵循的方式:

  • Save the domain extension or even complete host a user is visiting your site under. 保存域扩展名,甚至保存用户正在访问您网站的主机。 This could be done via Django sessions . 这可以通过Django会话来完成。
  • When getting redirected from the social network to your site, simply check the saved domain/host value. 从社交网络重定向到您的站点时,只需检查保存的域/主机值。 If it does not match the value of the current URL you do another redirect via Django's HttpResponseRedirect to your final domain/host. 如果它与当前URL的值不匹配,则通过Django的HttpResponseRedirect再次重定向到您的最终域/主机。

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

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