400 & 209 errors "Invalid session token" [SOLVED]

I just started attempting to signup with Moralis and it actually worked a couple hours ago, the thing is adding a new user actually worked but I wanted to add the ‘name’ to the server too… Now I keep trying to add another user but every time its a Bad Request…

import React, {useState} from 'react'
import './Register.css'
import { Form, Button, Modal, InputGroup } from 'react-bootstrap'
import  Navy from './Navbar'
import {useMoralis} from 'react-moralis'

const RegisterAdd = () => {
    const { signup } = useMoralis();

    const [name, setName] = useState("");
    const [username, setUsername] = useState("");
    const [password, setPassword] = useState("");
    const [email, setEmail] = useState("");
      return(
    <div>
        <Form>
            <Modal.Body>
                <Form.Group className="mb-3" controlId='name'>
                    <Form.Label>Name</Form.Label>
                    <Form.Control type="text" value={name} placeholder="Name" onChange={ (event) => setName(event.target.value) } />          
                </Form.Group>
                <Form.Group className="mb-3" controlId='username'>
                    <Form.Label>Username</Form.Label>
                    <InputGroup hasValidation>
                        <InputGroup.Text id="inputGroupPrepend">@</InputGroup.Text>
                    <Form.Control type="username" placeholder="Username" value={username}  onChange={ (event) => setUsername(event.target.value) } />
                    </InputGroup>
                </Form.Group>
                <Form.Group className="mb-3" controlId='password'>
                    <Form.Label>Password</Form.Label>
                    <Form.Control type="password" placeholder="Password" value={password}  onChange={ (event) => setPassword(event.target.value) }/>
                </Form.Group>
                <Form.Group className="mb-3" controlId='passwordConfirm'>
                    <Form.Label>Confirm Password</Form.Label>
                    <Form.Control type="password"  placeholder="Password" />
                </Form.Group>
                <Form.Group className="mb-3" controlId='email'>
                    <Form.Label>Email</Form.Label>
                    <Form.Control type="email" placeholder="Email" value={email} onChange={ (event) => setEmail(event.target.value) } />
                    <Form.Text className="text-muted">
                        We'll never share your email with anyone else.
                    </Form.Text>
                </Form.Group>
            </Modal.Body>
            <Modal.Footer>
                <Button variant="secondary" onClick={Navy.closeModal}>
                    Close
                </Button>
                <Button variant="info" onClick={() => signup(username, password, email, {text: name})}>
                    Register
                </Button>
            </Modal.Footer>
        </Form>
    </div>
    )
}

export default RegisterAdd

If you remove that part with sending the name it works fine?

Nope, doesn’t make a difference

Everything else works fine on your server?

@wesleyt95 Just tested it. It works correctly, make sure you are registering non-existing accounts with new username, email, phone

You can check error message there:

My server has 0 users so that shouldn’t be a problem right? I never dealt with a 202 error…

Idk I updated and restarted it 5+ minutes ago and its just loading… It should be fine I havent touched anything else.

The error is specifically at RestController.js, says this wrong

 xhr.send(data);

Please send us a screen


Logout from the session. And add some logic like:

const { isAuthenticated } = useMoralis();

<Button variant="info" disabled={isAuthenticated} onClick={() => signup(username, password, email, {text: name})}>
1 Like

That worked, thanks

1 Like

Happy BUIDLing :man_mechanic:

1 Like