在loginuser函数中,我想访问accesstoken的值,它位于“ststokenmanager”旁边,但是当我试图访问这个值时,我得到的是“undefind”值。
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')
}
}
请检查我的登录用户功能,因为我可以访问电子邮件和其他想法,但当我试图访问ststokenmanager时,我得到了未定义的值。而且,我正在使用firebase身份验证。