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
Expo Tienda Segura. No se puede guardar el ID de usuario y el token después de la autenticación

Estoy tratando de guardar el ID de usuario y el token en SecureStore. En la siguiente pantalla, puedo obtener un token de SecureStore, pero no puedo ver el ID de usuario.

 const doUserLogIn = async() => { try { const response = await fetch('http://someurl-dev.de/api/login/?email='+email+'&password='+password, { method: 'POST', headers: { Accept: 'application/json', 'Content-Type': 'application/json' } }); const json = await response.json(); SecureStore.setItemAsync('userid', json.userId); SecureStore.setItemAsync('token', json.token); } catch (e) { alert('Error1:'+e); } finally { try{ navigation.navigate('Schichten'); } catch(e) {alert('Error2:'+e); } } }

Y aquí está el json devuelto por llamada api

 {"userId":9,"token":"957a230f3eb6e63c47f1d7a0805fe31df6d2ced7","vorname":"Ankit","nachname":"Vij"}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No está esperando las funciones asíncronas setItemAsync . Deberías intentar lo siguiente:

 await SecureStore.setItemAsync('userid', json.userId); await SecureStore.setItemAsync('token', json.token);

Además, puede intentar registrar el valor de la variable json para asegurarse de que contiene el userId de usuario y las propiedades del token .

about 4 years ago · Juan Pablo Isaza Report
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!