I trying to delete an account in firebase using REST API, axios and React Native?
Look at my code:
import React, {Component} from 'react'
import {View, Text, TouchableOpacity, StyleSheet} from 'react-native'
import axios from 'axios'
class App extends Component {
deleteAccount = () => {
axios.post('https://identitytoolkit.googleapis.com/v1/accounts:delete?key=[API_KEY]', {
"idToken":"[FIREBASE_ID_TOKEN]"
})
}
render() {
return(
<View style={styles.container}>
<TouchableOpacity onPress={this.deleteAccount}>
<Text>Button</Text>
</TouchableOpacity>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
}
})
export default App
PS.: Maybe, I'm puting the wrong FIREBASE_ID_TOKEN
Where can I get the right FIREBASE_ID_TOKEN?
Reference: https://firebase.google.com/docs/reference/rest/auth?hl=pt-br#section-delete-account
Thanks!
axiosrequest usingcatch, and spout out the error. And you'll find the problem. If you still do need help then I would gladly help! P.S. Oh I just noticed you're using axios the wrong way. Check out the docs for example. - Irfandy Jip