Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
196 views
in Technique[技术] by (71.8m points)

google api - Failed To authenticate to specific firebase api project?

the project that I am trying to automate is This.

Manual Logged in

When I click on Google logged-in it will redirect to manual login. after I logged in successfully I can see there Post method

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???"

after that, it generates a Large respond

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>

I want to simulate it with post request with the postman after that, I will transfer it to Script

What I tried

Google API Config

I went to Google DashBoard Create Project.

Then I go to the OAuth consent screen and add my user as test users.

Add all the Clawee sites as authorizes.

Then I Went to Credentials and add Oauth 2.0 Client ID's of the Desktop client and got his ClientID and SecretID

Now from postman, I went to

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

I got my auth-code

now I send a request to

https://oauth2.googleapis.com/token

with params clientid,secretId,authCode,grant_type and get my Access Token + Refress Token

Now to check that, I navigate to https://www.googleapis.com/oauth2/v3/userinfo?access_token="

I got My User Info... It works

Now I tried to use that Access Token To login to Firebase app as they did but because I using my Own token and not a manual login I read about the "signInWithIdp" or "verifyCustomToken" And I tried with 'postBody': 'access_token=[My_Token]&providerId=google.com' or token: [My_Token]

Both Failed... What am I doing wrong?

question from:https://stackoverflow.com/questions/65942733/failed-to-authenticate-to-specific-firebase-api-project

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...