Inside loginUser function, I want to access the value of accessToken which is in side the 'stsTokenManager' but when i try to access this value then i am getting 'undefind' value.
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
Image,
Button,
TouchableWithoutFeedback, StatusBar, TextInput,
SafeAreaView, Keyboard, TouchableOpacity,
KeyboardAvoidingView
} from 'react-native';
import { CheckBox, Item, Label, Input } from 'native-base';
import * as firebase from 'firebase';
const firebaseconfig={
apiKey: " ",
authDomain: " ",
databaseURL: " ",
projectId: " ",
storageBucket: " ",
messagingSenderId: ""
};
firebase.initializeApp(firebaseconfig);
export default class Login extends Component{
// static navigationOptions = {
// header: null
// }
componentDidMount() {
firebase.auth().onAuthStateChanged((user) => {
if (user != null) {
console.log(user)
}
})
}
loginUser = (email, password) => {
try {
firebase.auth().signInWithEmailAndPassword(email, password )
.then((response)=>{
//here i want to access values of 'stsTokenManager'
console.log(response.user.stsTokenManager);
}
}
catch (error) {
alert('Check your email or password')
}
}
Please check my loginUser function because i am able to access email and other think but when i try to access stsTokenManager then i am getting undefind value.And, I am using firebase authentication.
response.user.toJSON().stsTokenManager
works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With