Trello API and Google Form no longer working
Asked by Kelly Rush:

Hello folks! I recently set up a nice little system for having internal users submit feature requests using a Google Form, which would automatically create a card in Trello in a triage column, with a label on it. I [used this tutorial](https://github.com/kmcroft13/submit-googleforms-to-trello) to build that workflow, and it worked really well...for about a month. Then, without any change on my end, it stopped working. I had my Google Form's script send me daily error reports for anything that failed, and this is what it started sending me:

Request failed for [https://api.trello.com/1/cards?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\&amp;token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX](https://api.trello.com/1/cards?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&amp;token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX) returned code 401. Truncated server response: invalid token (use muteHttpExceptions option to examine full response) (line 74, file \&quot;Code\&quot;)

(key and token have been redacted, key is 32 characters, token is 64 characters)

It seems very odd that this would be confirmed as working for a month (I submitted at least 10 times, and cards were generated each time), and then suddenly stopped working. I thought perhaps the token expired or something, so I re-generated a new token, but no luck there, it doesn't ever generate a card now.

Any thoughts? I'm stumped! Thanks in advance!


Answers:
author: matt
body: Hi Kelly,

My guess would be that one of the following occurred:

1. The token expired. Do you remember setting "expiration=never" when generating the token?

2. The token was revoked. You can check this by looking at <https://trello.com/me/account> as the Trello member who you generated the token as. Is the app still there?

3. The member you generated the token as no longer has write access to the board you are trying to create cards on. Perhaps they left or were removed from that board?

If it is either of the first two, the fix will be to create yourself a new token. If it is the third, make sure that member gets added back to the board so they can create cards on it.

- Matt

comments: author: Kelly Rush
body: Hey Matt, thanks so much for the ideas!

So I checked each of the items that you listed, here's what I came up with:

1. The token was set to expire, but I had just generated a new one two days ago, so it was set to expire a month from now.
2. The token was not revoked, I checked the status in my account, and it listed having "*read and write access on your account, read and write access on all your boards, and read and write access on all your teams*".
3. The member it should be using is my own account, and I confirmed that I am still able to create new cards, edit details, etc.

So...I'm at a loss as to why this isn't working, because it looks like everything is set up properly. The Google Form commits information, it kicks off an e-mail confirming there is a new item, no card is created in Trello, and then I get the error message at the end of the day that I posted above. As far as I can tell, I'm using the write token/key, and they're listed as being active. I also generated a new key and set it to "Never Expire", which I can confirm it is now listed as in my account.

Anything else worth trying? This is a huge savings to my workflow, as otherwise I'm having to manually create cards and then copy over a bunch of data into the details of each card. :(


author: matt
body: [@Kelly Rush](/t5/user/viewprofilepage/user-id/2036444) Hmm, I took a second look at the sample app script code, which appears fine.

I'm not terribly familiar with Google Appscript and what the update / deployment process is. Are you sure that any changes you made to update the token were actually deployed and being used? Perhaps those changes haven't been deployed so it is still using the old expired token?

I may be able to help a bit with the above if you can provide me with the app key that you are using (just the key, not the token).


author: marc -Collabello--Phase Locked-
body: [@Kelly Rush](/t5/user/viewprofilepage/user-id/2036444)Strange. Probably you should contact Trello support directly.


Tags: api

google