如何使用Meteor.js,Twitter和Oauth发布推文 [英] How to post a tweet with Meteor.js, Twitter and Oauth

查看:126
本文介绍了如何使用Meteor.js,Twitter和Oauth发布推文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Meteor和Twitter有点问题。
我想做的就是通过点击按钮发布推文。为此,我必须通过Oauth对Twitterservice进行身份验证。

i have a little problem with Meteor and Twitter. All i want to do is posting a tweet through a click on a button. For this I have to authenticate myself over Oauth to the Twitterservice.

目前我正在以一种非常复杂的方式进行身份验证,从客户端到服务器并返回。但现在我找到了Meteor.loginWithTwitter功能。最初我认为这个功能只是用于使用Twitterkeys将您登录到自己的应用程序中,现在我不再那么肯定了。也许我也可以用它来解决我的问题。因为看起来Oauth-Process完全(以简单的方式)在Meteor中实现。

At the moment i am doing the authentification in a really complicated way springing from client to server and back. But now I found the function Meteor.loginWithTwitter. Originally I thought this function is only for logging you into your own application with the Twitterkeys, now i am not so sure anymore. Probably I can also use it for my problem. Because it seems that the Oauth-Process is completely (and in a simple way) implemented in Meteor.

遗憾的是我找不到任何只是登录的文档或示例并得到最后的oauth_token。所以我从Meteor得到了所有我尝试以下代码,这是错误消息:

Sadly i cann't find any documentation or examples for just logging in and getting the final oauth_token. And so all i got from Meteor back then i try the following code, is this errormessage:

Erromessage:Accounts.ConfigError {message:Service not configured}

Erromessage: Accounts.ConfigError {message: "Service not configured"}

Meteor.loginWithTwitter( function(err){
  if (err){
    console.log(err)
  }else{
    console.log("yeah");
 }
});

我知道我必须在某个地方输入我的Appinformation,比如Consumer键,但我不知道在哪里。有人可以帮助我,并为我知道一些例子吗?或者知道我是否在正确的轨道上?

I know i have to enter somewhere my Appinformation like the Consumer key, but i have no idea where. Can someone help me out and knows some examples for me? Or knows if i am even on the right track?

谢谢和问候
Philipp

Thanks and greetings Philipp

推荐答案

最简单的方法:添加accounts-ui包:

The easiest way of doing this: Add the accounts-ui package:

meteor add accounts-ui accounts-twitter

并在你的模板中

{{loginButtons}}

第一个启动应用程序,单击登录按钮将指导您完成设置过程。您将创建一个Twitter应用程序,并将消费者密钥和消费者密钥复制到流星呈现给您的表单中。之后你可以使用Twitter登录。

On the first start of the application, a click on the login button will guide you through the setup process. You will create a Twitter application and copy the consumer key and consumer secret into a form, that meteor presents you. Afterwards you can log in using Twitter.

确保使用最新的Meteor版本(此时为0.5.2)

Make sure to use the latest Meteor version (0.5.2 at this moment)

这篇关于如何使用Meteor.js,Twitter和Oauth发布推文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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