GGTwitter: Let's settle this.

Okay so after hours of research and trial and error, I’m about overdue to have GGTwitter working smoothly. Graham Ranson over with Glitch Games has been a treasure, and the code he provides on GitHub is incredible. However, GGTwitter just isn’t clicking with me and many others. I’m really hoping some clear answers/guides can be shared on this thread. 

So, first, if someone can share exactly how to set up GGTwitter (files and all) that would be great. If you don’t know everything, that’s fine. Please share what you DO know. 

On my end, my current problem arrives when testing on a device. The simulator works great, but when I run my project on a device and call something such as “twitter:authorize()” I receive a white screen that says, “SSL is required.” Anybody know what’s up?

Thanks in advance to everyone who contributes!

Nathan

So I guess I’ll say the first thing to lure somebody in… :wink:

I’ve been going at this simply just to get Twitter successfully authorized. Here’s what I have:

local GGTwitter = require( "GGTwitter" ) local twitter local twitterListener = function( event ) if event.phase == "authorised" then print( "Twitter was authorized" ) else print( "Twitter was not authorized" ) end end twitter = GGTwitter:new( "xxxxxxx", "xxxxxxxxxxxxxx", twitterListener, "https://mycallbackurl.com" ) if twitter:isAuthorised() == false then twitter:authorise() else print("Twitter is already authorised.") end 

I’ve tried a good amount of variations and such, but I come across the same issue when testing on a device. Using this in the Corona simulator is a complete success, but when I test on a device I can see some action then the app goes white with a message that says, “SSL is required.” This error is what I must solve. 

Has anyone had a similar experience?

Nathan

I would suggest contacting Graham.

Excellent idea! I actually attempted last night, so I’ll wait patiently for a response. 

Pertaining to my SSL story, I just saw a message on the twitter developer site that says as of January 14th the Twitter API requires SSL/TLS for all connections. This is somewhat encouraging to know. The statement included a link:

https://dev.twitter.com/discussions/24239

I believe this is crucial for anyone using OAuth for their Twitter implementation. I’m about to read the post, click some links, and attempt to set my app straight. I’ll share any breakthroughs. 

Nathan

Let us know what you find. I am about to release my game but first need to implement twitter. Was about to get started on it last night, glad I chose a different route and ended up having a BBQ and some wonderful mixed drinks.

haha good for you! I’m in a similar boat. Twitter and Facebook implementations are my final move.

Honestly, I’m probably not qualified in any way to try to solve a technical issue like this, but just incase it gives anyone else a head start, I’ll share significant things I discover. (I’m pretty sure I’ll need Mr. Ranson’s heroics sometime soon.)

1). “Connections to api.twitter.com will be restricted to TLS/SSL connections only.”   As far as I know, SSL simply put means the “http” prefix has an “s”, which creates “https.”  Twitter now wants “httpS” exclusively. 

I searched the GGTwitter file and found two cases of “http”, and both were in links for api.twitter.com

Now, here’s the weird part, api.twitter.com doesn’t exist. ??? 

2). Line 18 in the oAuth.lua file provided by GlitchGames on GitHub reads:

local http = require("socket.http")

All I see here is an “http” with no “s”. I have no idea if it’s significant, and I have no idea what to make of this. I’m just sharing. 

Well, I have some good news and I have some neutral news. :slight_smile: The neutral news is everything I said above is rather irrelevant. The good news is all that irrelevance led me to the pleasantly easy and simple fix! I’ve tested it multiple times on a device, and it has functioned brilliantly. 

Here is what you must do:

--oAuth.lua provided by GlitchGames on GitHub --Line 244 native.showWebPopup( display.screenOriginX, display.screenOriginY, fullX, fullY, "http://api.twitter.com/oauth/authorize?oauth\_token=" .. twitterRequestToken, { urlRequest = listener } ) --Line 355 oAuth.makeRequest( "http://api.twitter.com/" .. self.apiVersion .. "/friendships/create.json", params, self.consumerKey, self.accessToken, self.consumerSecret, self.accessTokenSecret, "POST", postCallback ) --Locate the url in each line and change "http" to "https." 

It’s that simple! I can now authorize, follow, and post in my app using GGTwitter.

Nice! Thanks. Going to be throwing this in today. 

How timely!  I made those changes, and it works.

Thanks Nathan!

You are so welcome! I’m extremely thrilled that I could help some people out!

Hey everyone, Graham here from Glitch. Sorry I couldn’t get to this sooner but we’ve been away all weekend and only just back in the Office. Incredibly happy to see that you’ve already managed to fix the issue though, that’s awesome! I put those fixes directly into GGTwitter now so you should be able to get the latest version from GitHub.

Thanks for finding and fixing the issue!

Hello, 

Thanks first @GlitchGames for awesome GGTwitter sharing. But I got an error return while post a screenshot:

{"errors":[{"message":"Bad Authentication data","code":215}]} 

Of course, the simple text post is working. But every post with “Authorization” header type are all went wrong. Anyone gets a clue?

Thanks first for help.

So I guess I’ll say the first thing to lure somebody in… :wink:

I’ve been going at this simply just to get Twitter successfully authorized. Here’s what I have:

local GGTwitter = require( "GGTwitter" ) local twitter local twitterListener = function( event ) if event.phase == "authorised" then print( "Twitter was authorized" ) else print( "Twitter was not authorized" ) end end twitter = GGTwitter:new( "xxxxxxx", "xxxxxxxxxxxxxx", twitterListener, "https://mycallbackurl.com" ) if twitter:isAuthorised() == false then twitter:authorise() else print("Twitter is already authorised.") end 

I’ve tried a good amount of variations and such, but I come across the same issue when testing on a device. Using this in the Corona simulator is a complete success, but when I test on a device I can see some action then the app goes white with a message that says, “SSL is required.” This error is what I must solve. 

Has anyone had a similar experience?

Nathan

I would suggest contacting Graham.

Excellent idea! I actually attempted last night, so I’ll wait patiently for a response. 

Pertaining to my SSL story, I just saw a message on the twitter developer site that says as of January 14th the Twitter API requires SSL/TLS for all connections. This is somewhat encouraging to know. The statement included a link:

https://dev.twitter.com/discussions/24239

I believe this is crucial for anyone using OAuth for their Twitter implementation. I’m about to read the post, click some links, and attempt to set my app straight. I’ll share any breakthroughs. 

Nathan

Let us know what you find. I am about to release my game but first need to implement twitter. Was about to get started on it last night, glad I chose a different route and ended up having a BBQ and some wonderful mixed drinks.

haha good for you! I’m in a similar boat. Twitter and Facebook implementations are my final move.

Honestly, I’m probably not qualified in any way to try to solve a technical issue like this, but just incase it gives anyone else a head start, I’ll share significant things I discover. (I’m pretty sure I’ll need Mr. Ranson’s heroics sometime soon.)

1). “Connections to api.twitter.com will be restricted to TLS/SSL connections only.”   As far as I know, SSL simply put means the “http” prefix has an “s”, which creates “https.”  Twitter now wants “httpS” exclusively. 

I searched the GGTwitter file and found two cases of “http”, and both were in links for api.twitter.com

Now, here’s the weird part, api.twitter.com doesn’t exist. ??? 

2). Line 18 in the oAuth.lua file provided by GlitchGames on GitHub reads:

local http = require("socket.http")

All I see here is an “http” with no “s”. I have no idea if it’s significant, and I have no idea what to make of this. I’m just sharing. 

Well, I have some good news and I have some neutral news. :slight_smile: The neutral news is everything I said above is rather irrelevant. The good news is all that irrelevance led me to the pleasantly easy and simple fix! I’ve tested it multiple times on a device, and it has functioned brilliantly. 

Here is what you must do:

--oAuth.lua provided by GlitchGames on GitHub --Line 244 native.showWebPopup( display.screenOriginX, display.screenOriginY, fullX, fullY, "http://api.twitter.com/oauth/authorize?oauth\_token=" .. twitterRequestToken, { urlRequest = listener } ) --Line 355 oAuth.makeRequest( "http://api.twitter.com/" .. self.apiVersion .. "/friendships/create.json", params, self.consumerKey, self.accessToken, self.consumerSecret, self.accessTokenSecret, "POST", postCallback ) --Locate the url in each line and change "http" to "https." 

It’s that simple! I can now authorize, follow, and post in my app using GGTwitter.

Nice! Thanks. Going to be throwing this in today. 

How timely!  I made those changes, and it works.

Thanks Nathan!