Trello OAuth - 500 Server Error?
Asked by Victor Purolnik:

I am trying to build an application using OAuth v1 with Trello as described [here](https://developers.trello.com/page/authorization).

On the \`OAuthGetRequestToken\` request I am getting a \`500 Server Error\` with no further response back from Trello.

I am using a PHP library, however I can reproduce this just by running the following HTTP request in postman:

```
POST https://trello.com/1/OAuthGetRequestToken
```

with the following \`Authorization\` header (key, nonce and signature anonymized):

```
OAuth oauth_consumer_key="xxx", oauth_nonce="xxx", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1535936680", oauth_version="1.0", oauth_callback="http%3A%2F%2Ftrello.test%2Fauth%2Ftrello%2Fcallback", oauth_signature="xxx"
```

**Can anyone give me hints on how to debug this?** Is my request malformed? Even that should get me a proper error message and not cause Trello to smack me with a 500 in the face ;)

Thank you! :)


Answers:
author: bentley
body: Hey Victor,

Just to confirm, you're using the OAuth secret listed at the *bottom*of trello.com/app-key, correct?

We have a working example of an OAuth flow here: <https://glitch.com/edit/#!/trello-oauth>. Though it is written in Node and requires the oauth npm package.

comments: author: Victor Purolnik
body: Hey Bentley,

while I didn't find a solution, I found a workaround.

I created a blank, new Trello account, and everything worked with the key+secret given there.

I am not sure what is wrong with my main account's credentials. In any case, I think the Trello API shouldn't return a 500 Internal Server Error.

You can easily reproduce it sending the POST request above with my API key (can DM or email it to you) and any nonce and signature.

Something must be going wrong somewhere...

All the best,

Victor


author: Syauqi
body: Hi Victor,

I've submitted a request on the Trello Support Channel on your behalf and you can provide your personal information there to further investigate on the issue.

Cheers,

Syauqi


author: Victor Purolnik
body: Thanks Syauqi! :)


author: Syauqi
body: No worries Victor, glad we could help!


author: Tuan Nguyen
body: Hi Bentley and Victor,

I don't mean to post-snipe, but I asked a very related question last Friday about Trello OAuth that you two might have information about:

<https://community.atlassian.com/t5/Trello-questions/Trello-OAuthV1-invalid-token-in-Glitch-Example/qaq-p/880814>

The gist of it is that I couldn't get OAuth working in my application, and I also referenced the glitch example explaining that I couldn't get that working either.

Victor: it sounds like you did get Trello OAuth working so perhaps you might know a gotcha that I'm missing?

Bentley: it sounds like you're able to get the glitch example working, so perhaps you might have insight into what I'm doing wrong with respect to the glitch example (described in my question)?

Thanks,

Tuan


author: bentley
body: Can you give more info/context on what wasn't working? Did you see any error messages?


author: Tuan Nguyen
body: Hi Bentley,

Absolutely I can provide more details--in fact, I've already thoroughly described what wasn't working in the Trello question that I linked to above. Here is the link to the question that I posted again:

<https://community.atlassian.com/t5/Trello-questions/Trello-OAuthV1-invalid-token-in-Glitch-Example/qaq-p/880814>

You can also find it by searching for the title **"Trello OAuthV1 'invalid token' in Glitch Example"** and I'll post a comment on there tagging you so that it pops up on your radar.

Finally, in case you still can't get to my post for whatever reason, I'll include a summary of my problem here (duplicated on my post):

> With my TRELLO_KEY and TRELLO_OAUTH_SECRET provided to my remixed version of the Node.js project, I viewed it Live and attempted to go through the OAuth workflow.
>
> The first step of hitting \`<https://trello.com/1/OAuthAuthorizeToken>\` seems to have worked because I was prompted with
>
> Let Trello OAuth Example use your account? {#toc-hId-1823871084}
> ----------------------------------------------------------------
>
> Upon selecting "Allow", however, I see an empty page with just the text
>
> *"invalid token"*
>
> Am I using incorrect values in the \`.env\` file, or something? My only suspicion is that I'm using the wrong TRELLO_KEY because I thought it slightly odd to be using the API Key (as generated by Trello) as if it were the OAuthV1 HMAC Consumer Key, but I assumed that this is just how Trello implements OAuthV1. I found no explicit mention of what the Consumer Key is supposed to be, for what that's worth.


author: Victor Purolnik
body: [@tnnnguyen](/t5/user/viewprofilepage/user-id/51842)here's the thing, I did get it working - but I literally changed nothing in my code.

All I did is sign up for a brand new Trello account and use those credentials as API key and secret - and they worked, while the creds of my old Trello account resulted in a 500 error with no error message.

So I literally have no idea what was wrong and since it all works with the new creds, I believe my code was correct and this is a bug on Trello's side, but can't say for sure.

Sorry I can't be of any more help.


author: Tuan Nguyen
body: Thanks for the response, Victor.

I just borrowed a colleague's (key + secret) to see if maybe it's just my credentials are that busted, but the Trello OAuth glitch example didn't work with those credentials either.

Really hoping to hear back from Bentley / a Trello representative on this one -- [@Syauqi](/t5/user/viewprofilepage/user-id/845937) can you also look over my case and maybe submit a request on the Trello Support Channel on my behalf?

I'm reluctant to go up the contact chain <https://trello.com/contact> and reach out to support because I feel like there's already so much context between this thread and my own thread.


author: Syauqi
body: Sorry for the delay [@Tuan Nguyen](/t5/user/viewprofilepage/user-id/1256869), I've submitted Trello ticket to further look into the issue. You'll get a response from the Trello Support team soon.

Cheers


author: Tuan Nguyen
body: Hi [@Syauqi](/t5/user/viewprofilepage/user-id/845937),

Actually, I went ahead and contacted support, and I've been helped already. The resolution to my issue was posted as an answer to my Question linked above.

Thank you for the followup,

Tuan


author: Syauqi
body: Sorry for the confusion and thanks for the update [@Tuan Nguyen](/t5/user/viewprofilepage/user-id/1256869) :)


Tags: development

error

oauth