Set up OAuth 1 User Context with Custom Auth

hi everyone!

i'm currently trying to create a Retool resource for Twitter API v2. it requires OAuth 1.0a User Context authentication.

i've tried creating a resource for Twitter that uses OAuth 1.0 (one legged) by inputting my Consumer Key and Consumer Secret.

unfortunately, the request throws an error when running:

is the "OAuth 1.0a User Context" method referenced in the error above available in Retool? i need to use this authentication method specifically for the endpoint I'm trying to pull from.

i have the API key, API secret, access token, and access secret all at my disposal.

for reference, here is the docs for Twitter's API OAuth 1.0: OAuth 1.0a | Docs | Twitter Developer Platform

please let me know if you all can help!

Hey @jordanp!

Hmm, I'm not sure we directly support Oauth10.a, but you could potentially set this up by selecting Custom Auth and then adding an auth workflow step to make an API request similar to the one outlined here in Twitter's docs. Your setup could look something like this:

Our docs on custom auth here I think could be especially useful. Hope this helps, let me know if you hit any snags!

hey @victoria!

thanks so much for the detailed response! very helpful.

this makes sense -- I've begun tinkering with Custom Auth already, but I'm having trouble manually creating an OAuth Signature, as it's a very complex process.

i know tools like Postman automatically generate the signature when needed -- does Retool offer a similar service, or do you know how I would go about it? there's more information on Twitter's OAuth Signature process here: Creating a signature | Docs | Twitter Developer Platform

thank you kindly!

Ooh great question.

Bad news, it is indeed quite complicated :sweat_smile:

Good news, we actually have a (quite complicated) app that is able to accomplish this and successfully post to Twitter! I've attached it here and just redacted our own API info stored in the temporary state variable "twitterCredentials", so you'll need to add your own info there.

I will be the first to say I'm not fully comfortable with all that this app is doing, but there's nothing we can't figure out! Please do let me know if you have any questions :blush:


amazing! love the optimism, Victoria.

is there a link to this Retool app so i can dig in and try to emulate it? would be amazing to finally hit this endpoint :slight_smile:

No link, but I actually attached the JSON file for the app in my last message! Sorry, should've been clearer there :sweat_smile:

You can import this JSON file by clicking Create new (home page) > Import an app!

Thanks so much!

Good news -- I found a much simpler workaround. For some reason it didn't dawn on me that I could just use normal OAuth1 (not User Context) if I used the API keys/access tokens associated with the Twitter account i was trying to pull data from :sweat_smile:. So, I'm going to switch my authentication headers to the Twitter account I'm trying to pull data from, not a third-party Twitter acct like I'm using now.

So much simpler -- at least i learned a lot about APIs in the process!

Thanks again Victoria!

AH. Amazing. Glad the app at least served to push you in the exact opposite direction :sweat_smile:

Thank you for posting here to save future users the trouble :pray: