Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

143
Vistas
Unauthorized: /auth/users/

i am using react in the frontend and Django in the backend. Both are have been integrated perfectly but when I am trying to register user, but when I try creating new user I get error

Unauthorized: /auth/users/

[02/Dec/2021 12:29:27] "OPTIONS /auth/users/ HTTP/1.1" 401 58

The frontend looks like this

export const signup = (first_name, last_name, email, password, re_password) => async dispatch => {
const config = {
    headers: {
        'Content-Type': 'application/json'
    }
};

const body = JSON.stringify({ first_name, last_name, email, password, re_password });

try {
    const res = await axios.post(`${process.env.REACT_APP_API_URL}/auth/users/`, body, config);

    dispatch({
        type: SIGNUP_SUCCESS,
        payload: res.data
    });
} catch (err) {
    dispatch({
        type: SIGNUP_FAIL
    })
}

};

whereas the settings.py file looks like

MIDDLEWARE = [

'social_django.middleware.SocialAuthExceptionMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',

]

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql',
    'NAME': '',
    'USER': 'postgres',
    'PASSWORD': '',
    'HOST': 'localhost'
    
}

}

AUTH_PASSWORD_VALIDATORS = [
{
    'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
    'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
    'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
    'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},

]

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': [
    'rest_framework.permissions.IsAuthenticated'
],
'DEFAULT_AUTHENTICATION_CLASSES': (
    'rest_framework_simplejwt.authentication.JWTAuthentication',
),
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda