I am new to QuickBlox
. After going through the tutorial I have done the following to signup a new user into QuickBlox
. The problem is that I am getting the following errors:
1. {"errors":["Token is required"]}
2. STATUS : 201
I referred to the following question Register user to QuickBlox Users from android but it didn't help.
My Codes:
public class MainActivity extends ActionBarActivity implements OnClickListener {
Button sign_up;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
QBSettings.getInstance().fastConfigInit("XxxXX", "XXXXXX",
"XXXXXX");
sign_up = (Button) findViewById(R.id.sign_up);
sign_up.setOnClickListener(MainActivity.this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.sign_up:
QBAuth.createSession(new QBEntityCallback<QBSession>() {
@Override
public void onError(List<String> arg0) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess() {
// TODO Auto-generated method stub
final QBUser user = new QBUser("user1", "123456789");
user.setExternalId("45345");
user.setFullName("User1");
user.setPhone("123456789");
QBUsers.signUp(user, new QBEntityCallbackImpl<QBUser>() {
@Override
public void onSuccess(QBUser user, Bundle args) {
}
@Override
public void onError(List<String> errors) {
}
});
}
@Override
public void onSuccess(QBSession arg0, Bundle arg1) {
// TODO Auto-generated method stub
}
});
break;
default:
break;
}
}
}
Where did you get this error? It's not clear from your code example
Also the right way to create a user is inside this callback:
@Override
public void onSuccess(QBSession arg0, Bundle arg1)
not this
@Override
public void onSuccess()