Closed
Description
New Issue Checklist
- [x ] I am not disclosing a vulnerability.
- [ x] I am not just asking a question.
- [ x] I have searched through existing issues.
- [ x] I can reproduce the issue with the latest version of Parse Server.
Issue Description
Google oAuth login fails because of clientId cant be destructured because of a missing param
Steps to reproduce
user.linkWith('google', { authData: {
id: '123',
id_token: '123123',
access_token: '23123'
}});
Actual Outcome
error: Uncaught internal server error.Cannot destructure property `clientId` of 'undefined' or 'null'. {"stack":"TypeError: Cannot destructure property `clientId` of 'undefined' or 'null'.\n at verifyIdToken (node_modules/parse-server/lib/Adapters/Auth/google.js:66:4)\n at Object.validateAuthData (node_modules/parse-server/lib/Adapters/Auth/google.js:107:10)\n at node_modules/parse-server/lib/Adapters/Auth/index.js:93:20\n at node_modules/parse-server/lib/RestWrite.js:361:12\n at Array.map (<anonymous>)\n at RestWrite.handleAuthDataValidation (node_modules/parse-server/lib/RestWrite.js:350:45)\n at node_modules/parse-server/lib/RestWrite.js:496:17\n at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
TypeError: Cannot destructure property `clientId` of 'undefined' or 'null'.
at verifyIdToken (node_modules/parse-server/lib/Adapters/Auth/google.js:66:4)
at Object.validateAuthData (node_modules/parse-server/lib/Adapters/Auth/google.js:107:10)
at node_modules/parse-server/lib/Adapters/Auth/index.js:93:20
at node_modules/parse-server/lib/RestWrite.js:361:12
at Array.map (<anonymous>)
at RestWrite.handleAuthDataValidation (node_modules/parse-server/lib/RestWrite.js:350:45)
at node_modules/parse-server/lib/RestWrite.js:496:17
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Expected Outcome
Should return a 201 with created resource.
Environment
Server
- Parse Server version:
4.3.0
- Operating system:
MacOSX
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
Localhost
Database
- System (MongoDB or Postgres):
Mongo
- Database version:
4.X
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
Localhost
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
CloudCode + JS SDK
- SDK version:
1.8
Logs
verbose: REQUEST for [POST] /parse/functions/post_sign_in: {
"authData": {
"platform": {
"name": "google",
"auth": {
"id": "XXX",
"id_token": "XXX.XXX.X-X-X-XX-X-X-X-X-X",
"access_token": "X.X-XXX"
}
},
"profile": {
"email": "[email protected]",
"avatar": "https://lh3.xxx,
"firstName": "xxx",
"lastName": "xxx"
}
}
} {"method":"POST","url":"/parse/functions/post_sign_in","headers":{"host":"localhost:8080","connection":"keep-alive","content-length":"1816","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36","dnt":"1","content-type":"text/plain","accept":"*/*","origin":"http://localhost:3000","sec-fetch-site":"same-site","sec-fetch-mode":"cors","sec-fetch-dest":"empty","referer":"http://localhost:3000/","accept-encoding":"gzip, deflate, br","accept-language":"en-US,en;q=0.9"},"body":{"authData":{"platform":{"name":"google","auth":{"id":"xxx","id_token":"xx.xxx.xxx-j6O22-xx-xx-xx-x-xx-xxxx-x","access_token":"xxx.xxx"}},"profile":{"email":"[email protected]","avatar":"https://lh3.xx.com/a-/xx=s96-c","firstName":"xxx","lastName":"R"}}}}