Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Firebase身份验证重新加载页面后获取Youtube访问令牌_Firebase_Youtube Api_Firebase Authentication - Fatal编程技术网

使用Firebase身份验证重新加载页面后获取Youtube访问令牌

使用Firebase身份验证重新加载页面后获取Youtube访问令牌,firebase,youtube-api,firebase-authentication,Firebase,Youtube Api,Firebase Authentication,我希望用户在通过Firebase登录谷歌后能够访问他们的Youtube播放列表。我使用firebase.auth() 问题是,如果他们刷新页面,我就无法取回他们的访问令牌。Firebase会自动再次登录,但Firebase.auth().getRedirectResult()会返回 {用户:null,凭证:未定义,操作类型:未定义} 我尝试过谷歌的方法,但我不知道从哪里获得第二步中使用的授权码 非常感谢您的帮助。Firebase不提供刷新Google访问令牌的方法。也许您最好使用Google

我希望用户在通过Firebase登录谷歌后能够访问他们的Youtube播放列表。我使用
firebase.auth()

问题是,如果他们刷新页面,我就无法取回他们的访问令牌。Firebase会自动再次登录,但
Firebase.auth().getRedirectResult()
会返回

{用户:null,凭证:未定义,操作类型:未定义}
我尝试过谷歌的方法,但我不知道从哪里获得第二步中使用的授权码


非常感谢您的帮助。

Firebase不提供刷新Google访问令牌的方法。也许您最好使用Google web登录SDK来获取Google访问令牌: 它还会自动为您刷新。 然后,您可以传递Google访问令牌或ID令牌以使用Firebase登录:

firebase.auth().signInWithCredential(firebase.auth.GoogleAuthProvider.credential(googleIdToken, googleAccessToken));