You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is, on Android, when we get the session token back from the cloud code and try on Android Parseuser.becomeinbackground(token, callback);
The error that we get is com.parse.ParseRequest$ParseRequestException: bad json response
I checked and debugged and saw that the session token is the same session token i have in the database, they are totally the same.
The funny thing is, this worked on Api.parse.com but not on our hosted parse server.
So i am wondering if this is a parse function bug or a bug in the sdk.
Steps to reproduce
Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.
Use AnyPhone example on github, log in to the app with phone number
It sends back the user session token to android
3. It comes back to android and the user puts the code that was sent via twilio
and this function gets called
private void doLogin() {
if (mInputText.getText().toString().isEmpty() || mInputText.getText().toString().length
() != 4) {
mInputText.setError("4 digits only");
codeUI();
}
else {
int code = Integer.parseInt(mInputText.getText().toString());
HashMap<String, Object> params = new HashMap<>();
params.put("phoneNumber", phoneNumber);
params.put("codeEntry", code);
ParseCloud.callFunctionInBackground("logIn", params, new FunctionCallback<String>() {
public void done(String response, ParseException e) {
if (e == null)
{
Log.d(TAG, "It called this function");
Log.d (TAG, response);
mToken = response;
Log.d ("Cloud Response", "There were no exceptions! " + response);
ParseUser.becomeInBackground(mToken, new LogInCallback()
{
@Override
public void done(ParseUser parseUser, ParseException e) {
if (parseUser != null)
{
Log.d(TAG,"become in background worked");
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.put("user", parseUser);
installation.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
Intent intent = new Intent(SignupActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
});
}
else
{
Log.d(TAG, "parse become in background did not work");
Log.d(TAG, "No response was given");
Log.d("Cloud Response", "Exception: " + e.toString());
Toast.makeText(getApplicationContext(),
"Something went wrong. Please try again." + e.toString(),
Toast.LENGTH_LONG).show();
phoneNumberUI();
}
}
});
}
else
{
phoneNumberUI();
Log.d("Cloud Response", "Exception: " + response + e);
Toast.makeText(getApplicationContext(),
"Something went wrong. Please try again.",
Toast.LENGTH_LONG).show();
}
}
});
}
}
It fails at Parseuser.BecomeinBackground, due to the token being a bad json response.
Expected Results
It should run the becomeinbackground and log the user into the app
Actual Outcome
com.parse.ParseRequest$ParseRequestException: bad json response
Environment Setup
Server
parse-server version: [2.2.16]
Operating System: [64bit Amazon Linux 2016.03 v2.1.3 running Node.js]
Hardware: [N/A]
Localhost or remote server? (AWS)
Database
MongoDB version: [2.6]
Storage engine: [Sandbox]
Hardware: [Single database
on multi-tenanted process]
Localhost or remote server? (mLab)
I wonder is it a problem with the Parse Server the function Parse.User.login or is it a problem with the android code, ParseUser.become.
I am not so good with server or database stuff, as i am more android side of things. I will provide as much as I can.
The text was updated successfully, but these errors were encountered:
Hi @Abhishek-Mohan.
i tested it on my side and everything works well.
This is my android code:
ParseCloud.callFunctionInBackground("login",map, new FunctionCallback<Object>() {
@Override
public void done(Object object, ParseException e) {
if (object != null){
String token = (String) object;
ParseUser.becomeInBackground(token, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if (user != null){
Log.i("login",user.getEmail());
}
}
});
}
}
});
and in my cloud code i am calling the logIn function exactly like you did.
the only difference is that in the callFunctionInBackground callback function i received an Object and you receive a String
Hi, so I used the anyPhone example here for logging in with Twilio, https://github.com/ParsePlatform/AnyPhone
The problem is, on Android, when we get the session token back from the cloud code and try on Android Parseuser.becomeinbackground(token, callback);
The error that we get is com.parse.ParseRequest$ParseRequestException: bad json response
I checked and debugged and saw that the session token is the same session token i have in the database, they are totally the same.
The funny thing is, this worked on Api.parse.com but not on our hosted parse server.
So i am wondering if this is a parse function bug or a bug in the sdk.
Steps to reproduce
Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.
It sends back the user session token to android
3. It comes back to android and the user puts the code that was sent via twilio
and this function gets called
It fails at Parseuser.BecomeinBackground, due to the token being a bad json response.
Expected Results
It should run the becomeinbackground and log the user into the app
Actual Outcome
com.parse.ParseRequest$ParseRequestException: bad json response
Environment Setup
on multi-tenanted process]
I wonder is it a problem with the Parse Server the function Parse.User.login or is it a problem with the android code, ParseUser.become.
I am not so good with server or database stuff, as i am more android side of things. I will provide as much as I can.
The text was updated successfully, but these errors were encountered: