Skip to content

Conversation

@oliverlin-official
Copy link

Change Description

Fixed API authentication issue in login functionality

What Changed:

Added required API key header to the login HTTP request to resolve authentication errors.

Before:

  • The login request was sent without proper headers

  • Only included email and password in the request body

  • This caused "Missing API KEY" errors after attempting to login

After:

  • Added a third parameter to the defaultHttp.post() method containing headers configuration
  • Included 'Content-Type': 'application/json' header for proper request formatting
  • Added 'x-api-key': API_KEY header to provide the required API authentication
  • The API_KEY is imported from utils and passed in the request headers
    Technical Details:
// Before: Only 2 parameters (URL and data)
defaultHttp.post(apiRoutes.login, { email, password })

// After: 3 parameters (URL, data, and config with headers)
defaultHttp.post(apiRoutes.login, { email, password }, {
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': API_KEY
  }
})

Impact:

  • Resolves authentication errors during login
  • Ensures the API server receives the required API key for request validation
  • Maintains proper content type specification for JSON requests
    This change ensures the login request meets the API server's authentication requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant