Rewrite: I am trying to hook up the new moralis.auth with my existing parse db here is my auth code
async loginv2 (authData: any): Promise<any> {
const { message, signature } = authData
try {
const results = await Moralis.Auth.verify({
message, signature, network: 'evm'
})
const data = results.toJSON()
authData.chainId = data.chain
authData.nonce = data.nonce
authData.address = data.address
authData.version = data.version
authData.domain = data.domain
authData.expirationTime = data.expirationTime
authData.notBefore = data.notBefore
authData.resources = data.resources
authData.statement = data.statement
authData.uri = data.uri
} catch (e) {
this.logger.error(e)
}
const data = await this.createSigningData(message)
this.logger.debug({ authData: { ...authData } })
const user = await Parse.User.logInWith('moralisEth', { authData: { id: authData.address, signature, data } }).catch((e) => {
this.logger.error(e)
})
if (!user) throw new Error('Could not get user')
await user.setACL(new Parse.ACL(user))
user.addAllUnique('accounts', [authData.address])
user.set('ethAddress', authData.address)
await user.save(null)
const accessToken = this.jwtService.sign(user, { expiresIn: '7d' })
this.logger.debug(accessToken)
return { user, accessToken }
}
My code at Parse.User.logInWith
returns an error ParseError: 101 Eth address not verified.
any ideas?
For reference authdata looks like
"authData": {
"message": "pets.love wants you to sign in with your Ethereum account:\n0x30070B0A885A0c774780Dfe68B5932643eC511fE\n\nPlease sign this message to confirm your identity.\n\nURI: http://localhost:3001\nVersion: 1\nChain ID: 1\nNonce: ILxvhrE8HNfb2g96Y\nIssued At: 2022-08-31T21:55:36.490Z",
"signature": "0x7cb6f3721863845fa76c4f2e23e1d815c4820ddcf1edaa6ee966cdf1d2bf48b87af6b6dccaee7e368d44f393d96dc308fe24232c4c49e3e5c482176aa36c27121b",
"id": "DOjtqaV9EotbsrbnD",
"domain": "pets.love",
"address": "0x30070b0a885a0c774780dfe68b5932643ec511fe",
"statement": "Please sign this message to confirm your identity.",
"uri": "http://localhost:3001",
"version": "1",
"nonce": "ILxvhrE8HNfb2g96Y",
"profileId": "0x0dcdf1318f4741f3a29a2aa34d1f836aba9f27edaf7930cfddadc64e91226f90",
"chain": "0x1"
}