简体   繁体   English

将Spring Social与本机android应用程序集成

[英]Integrating spring social with native android app

I am developing an android app with Facebook, Twitter logins and custom posts with these providers. 我正在使用这些提供者的Facebook,Twitter登录名和自定义帖子开发一个Android应用程序。 But their callback sequence causes instability in my app. 但是它们的回调序列会导致我的应用不稳定。 I want to transfer login job. 我想转移登录作业。 I am curious about how can I integrate spring social to my native android app. 我很好奇如何将spring social集成到本机android应用程序中。 Is there any tutorial for that? 有针对性的教程吗? I am also using firebase. 我也在使用Firebase。 Actually all user management done by Firebase authentication. 实际上,所有用户管理都是通过Firebase身份验证完成的。 But as I mention, custom logins interrpt my child fragment flow in the app. 但是正如我提到的,自定义登录会在应用程序中中断我的子片段流。 With all these technologies, I cant decide a good application structure. 使用所有这些技术,我无法决定一个好的应用程序结构。 I am open to any suggestion. 我愿意接受任何建议。 Thank you already. 已经谢谢你了

First of all you should understand how can you work with third-party API (Google, Facebook , Twitter). 首先,您应该了解如何使用第三方API(Google, Facebook ,Twitter)。 Each of them implement OAuth2 flow. 它们每个都实现OAuth2流。

Simple case: 简单的情况:

  1. User inside app click social button with facebook. 应用内的用户单击带有Facebook的社交按钮。
  2. Then he should clicked allow button. 然后,他应该单击允许按钮。 (Better use SDK Android/IOS, because if user has facebook/twitter app it will appear for confirmation) (最好使用SDK Android / IOS,因为如果用户有facebook / twitter应用程序,它将显示以进行确认)
  3. SDK will fire your callback with payload such as user-id, token and etc. (In case of own WebView your should handle by yourself) SDK会使用有效负载(例如用户ID,令牌等)触发您的回调。(如果拥有自己的WebView,则应由您自己处理)
  4. Now you can do whatever (call some social api for fetching user data, send request to your backend for auth/register, or maybe firebase request) 现在您可以执行任何操作(调用一些社交api来获取用户数据,将请求发送到后端以进行身份​​验证/注册,或者可能是firebase请求)

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

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