parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

TypeError: Cannot match against 'undefined' or 'null' when doing login with AccountKit

Open mursang opened this issue 8 years ago • 1 comments

Issue Description

Getting Uncaught internal server error. TypeError: Cannot match against 'undefined' or 'null' when trying to login via Account Kit

Steps to reproduce

Server code

auth:{
facebookaccountkit: {
appIds: "xxxx",
appSecret: "xxxxx"
}
}

Client side (React Native, JS) Getting token from Facebook with SMS works perfect. This is the code to try to do login:

let authData = {
				  authData: {
				    access_token: token.token,
				    id: token.accountId
				  }
				}
var provider = {
				  authenticate(options) {
				    if (options.success) {
				      options.success(this, {});
				    }
				  },

				  restoreAuthentication(authData) {},

				  getAuthType() {
				    return 'facebookaccountkit';
				  },

				  deauthenticate() {}
				};
Parse.User.logInWith(provider, authData).then((response)=>{
		      	console.log(response);
		      }, (error) => {
		      	console.log(error);
		      });

Expected Results

Expected a good response, or an error.

Actual Outcome

Uncaught internal server error. TypeError: Cannot match against 'undefined' or 'null'. at Object.getValidatorForProvider (/xxxx/node_modules/parse-server/lib/Adapters/Auth/index.js:110:9)

Environment Setup

  • Server

    • parse-server version: 2.7.2
    • Operating System: Mac OS
    • Hardware:
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Localhost
  • Database

    • MongoDB version: -
    • Storage engine: -
    • Hardware: -
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Localhost

Logs/Trace

Uncaught internal server error. TypeError: Cannot match against 'undefined' or 'null'.
    at Object.getValidatorForProvider (/xxxx/node_modules/parse-server/lib/Adapters/Auth/index.js:110:9)
    at Object.keys.map.provider (/xxx/node_modules/parse-server/lib/RestWrite.js:256:58)
    at Array.map (native)
    at RestWrite.handleAuthDataValidation (/xxx/node_modules/parse-server/lib/RestWrite.js:252:45)
    at findUsersWithAuthData.then.r (/xxx/node_modules/parse-server/lib/RestWrite.js:368:17)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7) TypeError: Cannot match against 'undefined' or 'null'.
    at Object.getValidatorForProvider (/xxx/node_modules/parse-server/lib/Adapters/Auth/index.js:110:9)
    at Object.keys.map.provider (/xxx/node_modules/parse-server/lib/RestWrite.js:256:58)
    at Array.map (native)
    at RestWrite.handleAuthDataValidation (/xxxx/node_modules/parse-server/lib/RestWrite.js:252:45)
    at findUsersWithAuthData.then.r (/xxx/node_modules/parse-server/lib/RestWrite.js:368:17)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)

mursang avatar Mar 05 '18 23:03 mursang

Unless you're running parse-server from the lastest branch, account kit hasn't been released yet.

flovilmart avatar Mar 05 '18 23:03 flovilmart