-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
type:questionSupport or code-level questionSupport or code-level question
Description
New Issue Checklist
- Report security issues confidentially.
- Any contribution is under this license.
- Before posting search existing issues.
Issue Description
I'm using a custom Auth Adapter, but it doesn't actually run through the custom adapter.
Steps to reproduce
custom qq auth adapter
export default QQAuth;
module.exports = QQAuth
export class QQAuth extends BaseAuthCodeAdapter {
constructor() {
super("qq");
console.log("QQAuth=====>")
}
async getUserFromAccessToken(access_token, authData) {
console.log("getUserFromAccessToken=====>", authData)
return authData.id
}
async getAccessTokenFromCode(authData) {
console.log("getAccessTokenFromCode=====>", authData)
return "access_token"
}
}
//1. config
auth: {
qq: {
module: QQAuth,
enabled: true,
clientId: "clientId",
clientSecret: "clientSecret",
enableInsecureAuth: true,
},
//2. user authData
{
"qq": {
"id": "1BAA6C00C9CD43AA95BB1F30A0EA01B8"
},
"qq_unionid": {
"id": "UID_B7882A925E67EAE303A8665ED30EC2A8"
},
}
//3. use
await user.linkWith("sms", {
authData: {
id: mobileNum
}
}, {useMasterKey: true});
Actual Outcome
Parse error: ParseError: qq auth is invalid for this user.
[TS] at QqAdapter.beforeFind (D:\Test\parse\node_modules\parse-server\src\Adapters\Auth\BaseCodeAuthAdapter.js:34:15)
[TS] at map (D:\Test\parse\node_modules\parse-server\src\Auth.js:429:23)
[TS] at Array.map (<anonymous>)
[TS] at Object.findUsersWithAuthData (D:\Test\parse\node_modules\parse-server\src\Auth.js:424:15)
[TS] at RestWrite.handleAuthData (D:\Test\parse\node_modules\parse-server\src\RestWrite.js:541:24)
[TS] at RestWrite.validateAuthData (D:\Test\parse\node_modules\parse-server\src\RestWrite.js:484:19)
[TS] at D:\Test\parse\node_modules\parse-server\src\RestWrite.js:112:19
[TS] at processTicksAndRejections (node:internal/process/task_queues:95:5) {
[TS] code: 101
Expected Outcome
The error should normally occur from within my custom adapter, not the default QqAdapter.
Environment
Server
- Parse Server version:
8.1.0
- Operating system:
win10
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
Local
Database
- System (MongoDB or Postgres):
MongoDB
- Database version:
7.0
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
Local
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
no
- SDK version:
no
Logs
Metadata
Metadata
Assignees
Labels
type:questionSupport or code-level questionSupport or code-level question