Flutter google 登录为 google 验证 django 社交身份验证

sta*_*hit 5 django django-socialauth firebase-authentication google-signin flutter

我正在创建一个使用 google 登录的 flutter android 应用程序。登录后,我会收到 accesstoken 和 idtoken。我想使用此令牌来验证我的后端,该后端使用 django 社交身份验证和

  1. 如果用户已经注册,则登录并返回authoken,或者
  2. 注册用户,登录并返回用户 ID 和 authtoken。

这可能吗 ?如果是这样,请在线建议任何文件,或者请解释我应该如何处理这个问题。

小智 0

这是可能的,首先你必须使用 django Rest Framework 创建你的 api,下面的链接可以帮助你创建你的后端并为每个用户设置一个令牌:

https://dev.to/amartyadev/flutter-app-authentication-with-django-backend-1-21cp

然后你必须将社交身份验证添加到你的后端,你可以自己编写或使用下面的链接来使用库:

https://github.com/RealmTeam/django-rest-framework-social-oauth2

在这种方法之后,您必须创建您的 flutter 应用程序,以下链接是连接您的后端和 flutter 应用程序的有用资源:

https://www.asapdevelopers.com/flutter-login-app-with-python-backend/