updatePassword method
Implementation
Future<UpdatePasswordSuccess> updatePassword(String idToken, String password) async {
final url = Uri.parse('$firebaseUrl/accounts:update?key=$_firebaseKey');
final jsonRequestBody = jsonEncode({
'idToken': idToken,
'password': password,
'returnSecureToken': true,
});
final response = await http.post(
url,
headers: {'Content-Type': 'application/json'},
body: jsonRequestBody,
);
if (response.statusCode >= 200 && response.statusCode < 300) {
return UpdatePasswordSuccess.fromJson(jsonDecode(response.body));
} else {
throw WepinError(WepinErrorCode.failedPasswordSetting, 'code: ${response.statusCode} , body: ${response.body}');
}
}