it could depend on the issue that you have, you can use this python script to test the authentication:
import os
import sys
import json
import time
import datetime
from web3 import Web3
import requests
import binascii
API_KEY = "API_KEY_HERE"
PRIVATE_KEY = "e0947204af8184110cbdf74bf51600b53cae605d463fb8835053f0f78a0dc9b6"
ADDRESS = "0xaef5518aBDa8B89Ba96dBbC47156D6336Dc11Fb4"
def get_message_to_sign():
data = {
"domain": "defi.finance",
"statement": "Please confirm",
"uri": "https://defi.finance/",
"expirationTime": "2025-01-01T00:00:00.000Z",
"notBefore": "2020-01-01T00:00:00.000Z",
"resources": [
"https://docs.moralis.io/"
],
"timeout": 55,
"chainId": "1",
"address": ADDRESS
}
url = 'https://authapi.moralis.io/challenge/request/evm'
headers = {
"accept": "application/json",
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}
statusResponse = requests.request("POST", url, headers=headers, data=json.dumps(data))
data = statusResponse.content
data = json.loads(data)['message']
return data
def send_signature(message, signature):
data = {
"message": message,
"signature": "0x" + signature
}
print(json.dumps(data))
url = 'https://authapi.moralis.io/challenge/verify/evm'
headers = {
"accept": "application/json",
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}
statusResponse = requests.request("POST", url, headers=headers, data=json.dumps(data))
data = statusResponse.content
return data
def sign_message(message):
from web3.auto import w3
from eth_account.messages import encode_defunct
message = encode_defunct(text=message)
signed_message = w3.eth.account.sign_message(message, private_key=PRIVATE_KEY)
return signed_message
def authenticate():
data = get_message_to_sign()
time.sleep(2)
print(data)
signed_message = sign_message(data)
x = signed_message.signature
y = binascii.hexlify(x).decode('ascii')
print(y)
response = send_signature(data, y)
print(response)
authenticate()