There seems to be missing a guide for Google sign in with flutter, without firebase. Guides for firebase are in abundance, but if for any reason you want to go bare with google sign in, you are on your own.
似乎缺少有关在没有Firebase的情况下进行Google登录的指南。 Firebase的指南很多,但是如果您出于任何原因想要使用Google登录,那么您就自己一个人。
So let’s discover what is necessary for Google sign in with flutter;Most of it is also relevant for any other framework (Android native, react-native etc’).
因此,让我们发现使用flutter登录Google的必要条件;其中大多数也与任何其他框架(Android本机,react-native等)相关。
Our steps are:- Generate signed key for your android app- Registering the app in Google cloud services- Using google_sign_in
package to sign in with google
我们的步骤是:-为您的android应用生成签名密钥-在Google云服务中注册该应用-使用google_sign_in
程序包与google登录
必要的认证背景 (Necessary authentication background)
Google sign in is using oAuth 2.0 protocol, which in turn use various ways of authentication depending on the platform.
Google登录使用oAuth 2.0协议,该协议又会根据平台使用各种身份验证方式。
The details themselves are interesting but not relevant for you now, all you need to know is that in mobile the method is using some secure signature of the app to allow you to make requests.
详细信息本身很有趣,但现在与您无关。您需要知道的是,在移动设备中,该方法使用应用程序的一些安全签名来允许您发出请求。
Should you want to use the same google sign in with web application or server-to-server the communications way will be different. Server-to-server for example is more reliant on secret key passing, as you are in a “safe” environment and not running on a customer client.
如果您想在Web应用程序或服务器到服务器中使用相同的google登录,则通信方式会有所不同。 例如,服务器到服务器更依赖于密钥传递,因为您处于“安全”环境中并且不在客户客户端上运行。
What that means for you, is that in order to start using Google sign in with your android application, you need to sign it. Something you’d need to do anyway if you wish to release it to the playstore, but now is a good place to start.
这对您意味着什么,为了开始使用Google在Android应用程序中登录,您需要对其进行签名。 如果您希望将其发布到Playstore,则仍然需要执行某些操作,但是现在是一个不错的起点。
为您的Android应用生成签名密钥 (Generate signed key for your android app)
When generating signed key for android, there are 2 “channels” in the build that use the signed key: debug