Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
Problema con la API y Fiddler: la API de inicio de sesión solo funciona cuando Fiddler se está ejecutando: Laravel/Vue

Tengo una API de inicio de sesión como se ve a continuación:

api.php

 Route::post('/login', [LoginController::class, 'login']);

LoginController.php

 public function login(Request $request) { $fields = $request->validate([ 'email' => 'required|string', 'password' => 'required|string' ]); // Check email $user = User::where('email', $fields['email'])->first(); // Check password if(!$user || !Hash::check($fields['password'], $user->password)) { return response([ 'message' => 'Bad creds' ], 401); } $token = $user->createToken('myapptoken')->plainTextToken; $response = [ 'user' => $user, 'token' => $token ]; return response($response, 201); }

Llamo a esta API desde mi componente frontend Vue.js:

Script en Login.Vue

 <script> export default { name: 'Login', data() { return { user: { email: null, password: null }, loading: false, error: null } }, methods: { async login() { this.error = null; try { await this.$store.dispatch('login', this.user); await this.$router.push({ name: 'posts' }); } catch (error) { this.error = error; } finally { this.loading = false; } } } } </script>

tienda/index.js

 async login({ commit }, user) { await repository.createSession(); const { data } = await repository.login(user); commit('SET_USER', data); sessionStorage.user = JSON.stringify(data); sessionStorage.user_token = data.token; }

El problema es que solo funciona cuando Fiddler también se está ejecutando. Sin Fiddler, no obtengo ningún error, pero tampoco puedo iniciar sesión. ¿Qué podría estar mal?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!