Firebase Auth和Google日历创建 [英] Firebase Auth and Google Calendar Creation
问题描述
是否可以使用Firebase身份验证来向我的平台认证我的iOS/Web/Android用户,然后为每个用户创建一个Google日历并通过Firebase与其他用户同步?
Is it possible to use Firebase Authentication, to authenticate my iOS/Web/Android users to my platform, and then for each user to create a google calendar and sync them with the rest of the users through Firebase?
这是我第一次处理这样的事情,老实说我很困惑,到目前为止,有关API的文档对我没有帮助.
This is the first time that I'm dealing with something like this and I'm honestly confused, the documentation on the API's hasn't helped me thus far.
推荐答案
您可能要检查线程,其中指出:
You may want to check this thread wherein it was stated that:
除非您使用自定义身份验证来滚动自己的Google OAuth流程,否则目前无法用我知道的当前SDK执行此操作.
There is no way to currently do this with the current SDKs that I am aware of, unless you roll your own Google OAuth flow using custom authentication.
通读它,access_token
是一个遇到的问题.
Reading through it, one encountered problem is with the access_token
.
使用Google凭据登录到Firebase时,它会带您返回Google
access_token
,这很棒.不幸的是,该令牌仅持续一个小时,并且没有给您refresh token
的提示,这意味着您的应用程序在一小时后仍通过Firebase进行了身份验证时,您将无法再访问Google API,而不必强迫用户再次登录. /p>
When login to Firebase using Google credentials, it gives you back the Google
access_token
, which is great. Unfortunately, that token only last for an hour and you're NOT given arefresh token
, which means while your app is still authenticated against Firebase after an hour you can no longer access the Google APIs without forcing the user to login again.
作为一种解决方法,您可以尝试在Firebase外部处理身份验证
使用独立Auth客户端可以通过JavaScript客户端的load
函数加载:
As a workaround, you can try handling the authentication outside Firebase
using standalone Auth client which can be loaded with the JavaScript client's load
function:
<script src="https://apis.google.com/js/api.js" type="text/javascript"></script>
<script type="text/javascript">
gapi.load('auth2', init);
</script>
然后,按照本 Firebase文档.
最后,请参见此 SO帖子以了解其他见解.
Lastly, see this SO post for additional insights.
这篇关于Firebase Auth和Google日历创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!