Parse-server auth react question

Hi, I have a question, I want to continue using parse-server. and I don’t see an example of authentication, with parse server, and pure react, should I use wagmi? The parse-server example from the github repo is fine… should I add something else? and what would be the correct way for auth through react. Thanks guys

You should find examples in documentation for authentication. It is a little different than how authentication it works with a Moralis managed server.

Could you leave me the example of the documentation that gave applying with parse-server please?

You can find an example code in the below docs
https://v1docs.moralis.io/moralis-dapp/getting-started/self-hosting-moralis-server/client-connection#note-about-authentication

I don’t mean that, thanks john for replying, I mean this https://docs.moralis.io/authentication-api/evm/integrations/parse-server-nodejs. but in this last example I don’t understand this function:

const handleAuth = async () => {
   // Connect to Metamask
   const { signer, chain, account } = await connectToMetamask();

   if (!account) {
     throw new Error('No account found');
   }
   if (!chain) {
     throw new Error('No chain found');
   }

   const { message } = await requestMessage(account, chain);

   const signature = await signer.signMessage(message);

   const { user } = await verifyMessage(message, signature);

   renderUser(user);
};

I don’t understand where requestMessage and verifyMessage come from. is it a cloud? I see the parse code and I don’t understand that part, where does it come from? or how do I do those functions? And another question, I would like to write a custom field for authentication by metamask, as an example, to write a field in the user when authenticating that says loginType=''metamask''

As per the tutorial docs these functions are defined in authService.ts file. So yes these must part of the server cloud code.

To customise the functions you can update the code in authService.ts file and make it to accept custom parameters.

hmm, it looks like the example code might be incomplete. On the client side they must have also defined a separate verifyMessage and requestMessage functions to call the the cloud functions.

Yes, that is exactly what I am asking, not on the server side but on the client side, thank you very much John, and sorry for the inconvenience and abuse, but could you be more specific regarding the answer

?

I meant to say that you can define your own client-side function with custom parameters and logic. The main requirement from the client-side code is to call the requestMessage and verifyMessage cloud functions.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.