gpt4 book ai didi

android - 需要 QuickBlox token 错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:55:23 26 4
gpt4 key购买 nike

我一直在使用 quickblox 网站上的代码示例,但出现以下错误:

signIn error: Token is required

我的代码:

QBSettings.getInstance().fastConfigInit(APP_ID, AUTH_KEY, AUTH_SEC);
QBAuth.createSession("test", "test",new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
if (result.isSuccess()) {
// result comes here if authorization is success
Log.d(TAG,"createSession success");
QBSessionResult qbSessionResult = (QBSessionResult) result;
}else{
for(String s: result.getErrors()){
Log.d(TAG, "createSession error: " +s);
}
}
}
});

//getting error in here
QBUsers.signIn("test","test", new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
if (result.isSuccess()) {
Log.d(TAG,"signIn success");
QBUserResult qbUserResult = (QBUserResult) result;
} else {
for(String s: result.getErrors()){
Log.d(TAG, "signIn error: " +s);
}
}
}
});

session 已成功创建,并且在应用程序下的 quickblox 仪表板上存在用户“test”,密码为“test”。

请告知我做错了什么?

最佳答案

session 创建后你必须调用 QBUsers.signIn

    QBSettings.getInstance().fastConfigInit(APP_ID, AUTH_KEY, AUTH_SEC);
QBAuth.createSession("test", "test",new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
if (result.isSuccess()) {

QBUsers.signIn("test","test", new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
if (result.isSuccess()) {
Log.d(TAG,"signIn success");
QBUserResult qbUserResult = (QBUserResult) result;
} else {
for(String s: result.getErrors()){
Log.d(TAG, "signIn error: " +s);
}
}
}
});


}else{
for(String s: result.getErrors()){
Log.d(TAG, "createSession error: " +s);
}
}
}
});

关于android - 需要 QuickBlox token 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16089059/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com