Twitter follower check

Hello, I’m looking to implement a feature where it gives a bonus to players who are following a certain twitter account. I’ve tried using the Twitter API, but I am getting errors.

image

Code:

local twitter = require(game.ServerStorage.TwitterAPI)
twitter.init(game.ServerStorage.TestScript:GetAttribute("key"), game.ServerStorage.TestScript:GetAttribute("secret_key"))

local result = twitter.followers_id("twitterdev")
print(tostring(result))
1 Like

is this a serverscript or a localscript?

ServerScript of course. I would be getting errors even trying to access HttpService if I were using a local script.

the URL has an error {"errors":[{"code":215,"message":"Bad Authentication data."}]}.

1 Like

I updated the screenshot/code, I’m still getting “HTTP 403 Forbidden” errors.

Could you link the module you’re using?

turn on Enable Studio Access To API Services and HTTP Services
if that didn’t work
make the game public and try again.

here’s a similar issue to yours

The problem with that is that they use Proxy Service as a work around, and I can’t deploy my own Heroku app.

image

They said using request async is a way to do it. Now my issue is actually trying to have authorization. I already got my consumer key and secret key, but I’m new to using HttpService so I have no clue how to go about this.

do you have a Twitter developer account? It is needed to use their API

1 Like

Yes I do. I have the consumer and secret key.Everytime I try to access it it says unauthorized.

You need to use the Bearer token, unfortunately, as you’ve stated before Heroku doesn’t really accept ProxyService anymore so as a workaround I would suggest using a Glitch application to host a database that updates every 60 seconds with all of the users currently following you, then when you go in-game and insert your username, search through said database for the username, and return true/false depending on whether the username is found or not.

I really don’t remember the names of the endpoints that you need to use for this but I’m pretty sure it is in the v2 category and doesn’t require elevated access.

I wish you the best of luck and feel free to ask me anything else!

I’m not familiar with making a using a Glitch application or being able to update a database every 60 seconds, so how would I go about this?