Web 应用程序与 facebook 的集成(架构问题) [英] Web app integration with facebook ( architecture issues )

查看:42
本文介绍了Web 应用程序与 facebook 的集成(架构问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 facebook 之上构建自己的社交平台,欢迎就我的网络应用程序架构提出一些建议.

I'm building my own social platform on top of facebook, and some advice on the architecture of my web app would be welcome.

我需要一些从 Facebook API 返回的数据,为了获得这些数据,我知道我需要让我的用户使用 Facebook (OAuth 2.0) 登录.在这之后,我有点困惑.

I need some data that is returned from the Facebook APIs, in order to get that data I know I need to make my users login with Facebook ( OAuth 2.0 ). After this is where I'm a little bit confused.

我是否应该从后端调用 Facebook API(我使用的是 Python),然后将相同的数据作为响应返回?

Should I call Facebook APIs from the backend ( I'm using Python ) and then return that same data back as a response?

我是否应该从前端(浏览器的 Javascript)调用 Facebooks API,然后将该数据再次发送到我的后端?

Should I call Facebooks API from the front end ( browser's Javascript ) and then sent that data again to my backend?

一旦用户授权我的应用程序,后端是否可以继续从 Facebook API 获取信息?.

Once the user has authorized my app, can the backend keep getting info from facebook APIs?.

提前致谢.

推荐答案

一旦您获得 Facebook 访问令牌,就完全取决于您如何使用它.如果您仅从浏览器访问 Facebook API 并且从服务器访问,那就完全没问题了.这完全取决于您想要实现的目标.

Once you get the Facebook Access Token is really up to you how you use it. It is perfectly fine if you only access the Facebook API from the browser and also if you do it from the server. It all depends on what you want to achieve.

如果您希望后端能够访问 Facebook API,则它需要具有访问令牌.此外,令牌有一个到期日期,因此只要它有效,后端就可以继续从 Facebook 请求数据,但一旦到期,您就必须对其进行更新.

If you want the backend to have access to the Facebook API it needs to have the access token. Also, the token has an expiration date, so as long as it is valid, the backend can keep requesting data from Facebook, but once it expires you'll have to renew it.

这篇关于Web 应用程序与 facebook 的集成(架构问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆