Custom authentication how to include

Hi guys,

I’m a newbie in parse development one but I like to parse concept a lot.
I’m struggling with a adding custom authenticator.
I would like simply to allow users to log in by clicking link that they get in email (there would be token included).
I found out that there is no option in cloud code to just sign in without password (even using master key). So I had to create custom authenticator.
But I can’t make it running on Mac (using parse-server command from brew install). It keeps telling me:
Cannot find module ‘TokenAuth’
I’ve created auth module but I don’t know how to include it.
I used full path
const TokenAuth = require(’/Users/aa/Workspace/tokenproject/cloud/TokenAuth.js’);
I tried to add it to /usr/local/lib/node_modules/parse-server/lib/ParseServer.js
in many places but it’s still not found.

Can anyone help me?
Thank you.

I’ve finally managed that by updating json config file and adding explicit path to the module

“auth”: {
“TokenAuth”: {
“module”: “/Users/aa/Workspace/tokenproject/cloud/TokenAuth.js”,
“option1”: “token”
}
}

Now I’m having problems with unlinking user from the authorization. So that he can only log in one time with that specific token. I tried such function but seems it’s not changing the authData of the user.

Parse.Cloud.define(“unlinkAuthToken”, async (request) => {

var res = await request.user._unlinkFrom(‘TokenAuth’,{useMasterKey:true});
await request.user.save(null,{useMasterKey:true});

});