问题描述
手动登录
当我点击 Google 登录时,它将重定向到手动登录。 登录成功后可以看到Post方法
Request URL: https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key=AIzaSyDF-qMBES2pwjDAzWRRsu-FiAxZgJsBuIk
Request Method: POST
with the body
requestUri: "FirebaseappURL"
returnIdpCredential: true
returnSecuretoken: true
sessionId: "SessionID???"
之后,它会产生一个大响应
context: ""
displayName.
emailverified.
expiresIn:3600
federatedId:...
firstName:.
fullName:.
idToken: <Token>
kind: "identitytoolkit#VerifyAssertionResponse"
lastName: ...
localId: <ID>
oauthAccesstoken: <Token>
oauthExpireIn: 3600
oauthIdToken: <Token>
photoUrl: <url>
providerId: "google.com"
rawUserInfo: <long json>
refreshToken: <token>
我想用邮递员的post请求来模拟它 之后,我将其转移到 Script
我尝试了什么
Google Api 配置
我去了 Google DashBoard 创建项目。
然后我转到 OAuth 同意屏幕并将我的用户添加为测试用户。
然后我转到凭据并添加桌面客户端的 Oauth 2.0 客户端 ID 并得到了他的 ClientID 和 SecretID
现在从邮递员那里,我去了
https://accounts.google.com/o/oauth2/v2/auth?client_id=<ClientID>.apps.googleusercontent.com&response_type=code&scope=openid%20email&access_type=offline&redirect_uri=urn:ietf:wg:oauth:2.0:oob
我得到了我的验证码
现在我向
发送请求https://oauth2.googleapis.com/token
使用参数 clientid,secretId,authCode,grant_type 并获取我的访问令牌 + 刷新令牌
现在检查一下,我导航到 https://www.googleapis.com/oauth2/v3/userinfo?access_token=”
我得到了我的用户信息...它有效
现在我尝试使用该访问令牌 像他们一样登录 Firebase 应用程序 但因为我使用自己的令牌而不是手动登录 我读到了“signInWithIdp”或“verifyCustomToken” 我试过 使用“postBody”:“access_token=[My_Token]&providerId=google.com”或 令牌:[My_Token]
都失败了... 我做错了什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)