How to send a POST request with OAUTH in Lua
So I want to tweet on Twitter by sending a POST request to the Twitter API.
I have not found a simple way to do this (unless I use a wrapper), and I'm not too experienced with Lua.
This is Twitter's own example using curl:
$ curl --request POST
--url 'https://api.twitter.com/1.1/statuses/update.json?
status=Test%20tweet%20using%20the%20POST%20statuses%2Fupdate%20endpoint'
--header 'authorization: OAuth oauth_consumer_key="YOUR_CONSUMER_KEY",
oauth_nonce="AUTO_GENERATED_NONCE", oauth_signature="AUTO_GENERATED_SIGNATURE",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="AUTO_GENERATED_TIMESTAMP",
oauth_token="USERS_ACCESS_TOKEN", oauth_version="1.0"'
--header 'content-type: application/json'
But from some wrappers I've seen, it seems that you can use:
consumer_key
consumer_secret
access_token
access_token_secret
I just want a simple way of tweeting without being able to have all of the other API functionality that the Twitter API has. So no wrapper or anything. Just a simple script, but I can't seem to figure it out. Any help is greatly appreciated.
twitter oauth lua twitter-oauth luasocket
add a comment |
So I want to tweet on Twitter by sending a POST request to the Twitter API.
I have not found a simple way to do this (unless I use a wrapper), and I'm not too experienced with Lua.
This is Twitter's own example using curl:
$ curl --request POST
--url 'https://api.twitter.com/1.1/statuses/update.json?
status=Test%20tweet%20using%20the%20POST%20statuses%2Fupdate%20endpoint'
--header 'authorization: OAuth oauth_consumer_key="YOUR_CONSUMER_KEY",
oauth_nonce="AUTO_GENERATED_NONCE", oauth_signature="AUTO_GENERATED_SIGNATURE",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="AUTO_GENERATED_TIMESTAMP",
oauth_token="USERS_ACCESS_TOKEN", oauth_version="1.0"'
--header 'content-type: application/json'
But from some wrappers I've seen, it seems that you can use:
consumer_key
consumer_secret
access_token
access_token_secret
I just want a simple way of tweeting without being able to have all of the other API functionality that the Twitter API has. So no wrapper or anything. Just a simple script, but I can't seem to figure it out. Any help is greatly appreciated.
twitter oauth lua twitter-oauth luasocket
Have you seen this regex.info/blog/lua/twitter (probably outdated)
– wp78de
Nov 25 '18 at 22:45
It is indeed outdated.
– Tearzz
Nov 26 '18 at 0:41
add a comment |
So I want to tweet on Twitter by sending a POST request to the Twitter API.
I have not found a simple way to do this (unless I use a wrapper), and I'm not too experienced with Lua.
This is Twitter's own example using curl:
$ curl --request POST
--url 'https://api.twitter.com/1.1/statuses/update.json?
status=Test%20tweet%20using%20the%20POST%20statuses%2Fupdate%20endpoint'
--header 'authorization: OAuth oauth_consumer_key="YOUR_CONSUMER_KEY",
oauth_nonce="AUTO_GENERATED_NONCE", oauth_signature="AUTO_GENERATED_SIGNATURE",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="AUTO_GENERATED_TIMESTAMP",
oauth_token="USERS_ACCESS_TOKEN", oauth_version="1.0"'
--header 'content-type: application/json'
But from some wrappers I've seen, it seems that you can use:
consumer_key
consumer_secret
access_token
access_token_secret
I just want a simple way of tweeting without being able to have all of the other API functionality that the Twitter API has. So no wrapper or anything. Just a simple script, but I can't seem to figure it out. Any help is greatly appreciated.
twitter oauth lua twitter-oauth luasocket
So I want to tweet on Twitter by sending a POST request to the Twitter API.
I have not found a simple way to do this (unless I use a wrapper), and I'm not too experienced with Lua.
This is Twitter's own example using curl:
$ curl --request POST
--url 'https://api.twitter.com/1.1/statuses/update.json?
status=Test%20tweet%20using%20the%20POST%20statuses%2Fupdate%20endpoint'
--header 'authorization: OAuth oauth_consumer_key="YOUR_CONSUMER_KEY",
oauth_nonce="AUTO_GENERATED_NONCE", oauth_signature="AUTO_GENERATED_SIGNATURE",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="AUTO_GENERATED_TIMESTAMP",
oauth_token="USERS_ACCESS_TOKEN", oauth_version="1.0"'
--header 'content-type: application/json'
But from some wrappers I've seen, it seems that you can use:
consumer_key
consumer_secret
access_token
access_token_secret
I just want a simple way of tweeting without being able to have all of the other API functionality that the Twitter API has. So no wrapper or anything. Just a simple script, but I can't seem to figure it out. Any help is greatly appreciated.
twitter oauth lua twitter-oauth luasocket
twitter oauth lua twitter-oauth luasocket
asked Nov 25 '18 at 0:54
TearzzTearzz
148110
148110
Have you seen this regex.info/blog/lua/twitter (probably outdated)
– wp78de
Nov 25 '18 at 22:45
It is indeed outdated.
– Tearzz
Nov 26 '18 at 0:41
add a comment |
Have you seen this regex.info/blog/lua/twitter (probably outdated)
– wp78de
Nov 25 '18 at 22:45
It is indeed outdated.
– Tearzz
Nov 26 '18 at 0:41
Have you seen this regex.info/blog/lua/twitter (probably outdated)
– wp78de
Nov 25 '18 at 22:45
Have you seen this regex.info/blog/lua/twitter (probably outdated)
– wp78de
Nov 25 '18 at 22:45
It is indeed outdated.
– Tearzz
Nov 26 '18 at 0:41
It is indeed outdated.
– Tearzz
Nov 26 '18 at 0:41
add a comment |
1 Answer
1
active
oldest
votes
Use a specialized Lua library for Twitter, e.g. https://github.com/leafo/lua-twitter
luarocks install https://luarocks.org/manifests/leafo/twitter-dev-1.rockspec
or a more general Lua library for OAuth, e.g. https://github.com/ignacio/LuaOAuth and do the rest yourself.
I would like to do all of this is one script by only using libraries like Sha1, JSON, and LuaSocket. I don't want functionality to any other part of the Twitter API.
– Tearzz
Nov 25 '18 at 15:04
1
I'm experiencing with lua-cURL to do HTTP requests. Because luasocket isn't able to do the actual tls standard. lua-cURL has some build in options for authentication (for instance Basic and Digest). Bearer needs libcurl 7.61.0. So you could write a function to handle the OAuth 2.0 with several requests.
– csaar
Nov 26 '18 at 7:57
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53463767%2fhow-to-send-a-post-request-with-oauth-in-lua%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use a specialized Lua library for Twitter, e.g. https://github.com/leafo/lua-twitter
luarocks install https://luarocks.org/manifests/leafo/twitter-dev-1.rockspec
or a more general Lua library for OAuth, e.g. https://github.com/ignacio/LuaOAuth and do the rest yourself.
I would like to do all of this is one script by only using libraries like Sha1, JSON, and LuaSocket. I don't want functionality to any other part of the Twitter API.
– Tearzz
Nov 25 '18 at 15:04
1
I'm experiencing with lua-cURL to do HTTP requests. Because luasocket isn't able to do the actual tls standard. lua-cURL has some build in options for authentication (for instance Basic and Digest). Bearer needs libcurl 7.61.0. So you could write a function to handle the OAuth 2.0 with several requests.
– csaar
Nov 26 '18 at 7:57
add a comment |
Use a specialized Lua library for Twitter, e.g. https://github.com/leafo/lua-twitter
luarocks install https://luarocks.org/manifests/leafo/twitter-dev-1.rockspec
or a more general Lua library for OAuth, e.g. https://github.com/ignacio/LuaOAuth and do the rest yourself.
I would like to do all of this is one script by only using libraries like Sha1, JSON, and LuaSocket. I don't want functionality to any other part of the Twitter API.
– Tearzz
Nov 25 '18 at 15:04
1
I'm experiencing with lua-cURL to do HTTP requests. Because luasocket isn't able to do the actual tls standard. lua-cURL has some build in options for authentication (for instance Basic and Digest). Bearer needs libcurl 7.61.0. So you could write a function to handle the OAuth 2.0 with several requests.
– csaar
Nov 26 '18 at 7:57
add a comment |
Use a specialized Lua library for Twitter, e.g. https://github.com/leafo/lua-twitter
luarocks install https://luarocks.org/manifests/leafo/twitter-dev-1.rockspec
or a more general Lua library for OAuth, e.g. https://github.com/ignacio/LuaOAuth and do the rest yourself.
Use a specialized Lua library for Twitter, e.g. https://github.com/leafo/lua-twitter
luarocks install https://luarocks.org/manifests/leafo/twitter-dev-1.rockspec
or a more general Lua library for OAuth, e.g. https://github.com/ignacio/LuaOAuth and do the rest yourself.
answered Nov 25 '18 at 2:21
wp78dewp78de
10.3k61940
10.3k61940
I would like to do all of this is one script by only using libraries like Sha1, JSON, and LuaSocket. I don't want functionality to any other part of the Twitter API.
– Tearzz
Nov 25 '18 at 15:04
1
I'm experiencing with lua-cURL to do HTTP requests. Because luasocket isn't able to do the actual tls standard. lua-cURL has some build in options for authentication (for instance Basic and Digest). Bearer needs libcurl 7.61.0. So you could write a function to handle the OAuth 2.0 with several requests.
– csaar
Nov 26 '18 at 7:57
add a comment |
I would like to do all of this is one script by only using libraries like Sha1, JSON, and LuaSocket. I don't want functionality to any other part of the Twitter API.
– Tearzz
Nov 25 '18 at 15:04
1
I'm experiencing with lua-cURL to do HTTP requests. Because luasocket isn't able to do the actual tls standard. lua-cURL has some build in options for authentication (for instance Basic and Digest). Bearer needs libcurl 7.61.0. So you could write a function to handle the OAuth 2.0 with several requests.
– csaar
Nov 26 '18 at 7:57
I would like to do all of this is one script by only using libraries like Sha1, JSON, and LuaSocket. I don't want functionality to any other part of the Twitter API.
– Tearzz
Nov 25 '18 at 15:04
I would like to do all of this is one script by only using libraries like Sha1, JSON, and LuaSocket. I don't want functionality to any other part of the Twitter API.
– Tearzz
Nov 25 '18 at 15:04
1
1
I'm experiencing with lua-cURL to do HTTP requests. Because luasocket isn't able to do the actual tls standard. lua-cURL has some build in options for authentication (for instance Basic and Digest). Bearer needs libcurl 7.61.0. So you could write a function to handle the OAuth 2.0 with several requests.
– csaar
Nov 26 '18 at 7:57
I'm experiencing with lua-cURL to do HTTP requests. Because luasocket isn't able to do the actual tls standard. lua-cURL has some build in options for authentication (for instance Basic and Digest). Bearer needs libcurl 7.61.0. So you could write a function to handle the OAuth 2.0 with several requests.
– csaar
Nov 26 '18 at 7:57
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53463767%2fhow-to-send-a-post-request-with-oauth-in-lua%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you seen this regex.info/blog/lua/twitter (probably outdated)
– wp78de
Nov 25 '18 at 22:45
It is indeed outdated.
– Tearzz
Nov 26 '18 at 0:41