解析服务器开源Android Twitter登录不起作用 [英] Parse server open source Android Twitter Login is not working

查看:132
本文介绍了解析服务器开源Android Twitter登录不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Parse Server开发Android应用程序.目前,普通登录系统和Facebook登录系统运行良好.但是,Twitter登录无法正常工作.

I am developing Android Application with Parse Server. Right now, the normal login system and Facebook login system is working well. However, Twitter login is not working.

这是我的代码:

twitterLogin.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        ParseTwitterUtils.logIn(MainActivity.this, new LogInCallback() {
            @Override
            public void done(ParseUser user, ParseException err) {
                if (user == null) {
                    Log.d("MyApp", "Uh oh. The user cancelled the Twitter login.");
                } else if (user.isNew()) {
                    Log.d("MyApp", "User signed up and logged in through Twitter!");
                } else {
                    Log.d("MyApp", "User logged in through Twitter!");
                }
            }
        });

    }
});

ParseTwitterUtils.initialize("","");

我只是从解析服务器文档中复制.

I just copy from parse server doc.

我登录时的gif 有时,它给出以下日志: 哦哦用户取消了Twitter登录

the gif when i login Sometime, it gives this log: Uh oh. The user cancelled the Twitter login

twitter弹出并登录后的gif 它不提供任何日志.所以我认为它不起作用

the gif when twitter pop up and login it doesn't give any log. so i don't think it is working

推荐答案

我正面临着同样的问题!似乎解析服务器默认情况下不具有Twitter集成.我正在调查!

I'm facing the same issue! Seems that parse server doesn't have twitter integration by default. I'm looking into it!

这是我得到的堆栈跟踪:

Here is the stack trace I'm getting:

com.parse.ParseRequest$ParseRequestException: 
at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:279)
at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:303)
at com.parse.ParseRESTUserCommand.onResponseAsync(ParseRESTUserCommand.java:126)
at com.parse.ParseRequest$3.then(ParseRequest.java:137)
at com.parse.ParseRequest$3.then(ParseRequest.java:133)
at bolts.Task$15.run(Task.java:917)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:908)
at bolts.Task.continueWithTask(Task.java:715)
at bolts.Task.continueWithTask(Task.java:726)
at bolts.Task$13.then(Task.java:818)
at bolts.Task$13.then(Task.java:806)
at bolts.Task$15.run(Task.java:917)
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$Worker.run(
at java.lang.Thread.run(Thread.java:818)

修改: 我找到了解决方案,在您的解析服务器中,您必须配置以下内容:

I found the solution, in your parse server you must configure something like this:

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',  // Don't forget to change to https if needed

  oauth: {
   twitter: {
     consumer_key: "xxx", // REQUIRED
     consumer_secret: "xxx" // REQUIRED
   },
   facebook: {
     appIds: "xxxx"
   }
  }

});

此处 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆