I'm trying to write an app that updates my Trello cards with the API. How do I get a permanent user token for the app to write to my Trello board?
Thanks
I'm trying to write an app that updates my Trello cards with the API. How do I get a permanent user token for the app to write to my Trello board?
Thanks
If you only need a token for personal use you can get
app-key
,secret
andtoken
based on you being logged in over here.You can do this in one of 2 ways -
Direct the user to the below address. This will direct the user to a page that has a token that she can copy and paste back to you. The important bit is that you ask for
expiration = never
andscope = read,write
Or use OAuth (harder) to automate the request for an access token. Read more in the documentation.
Once you have the token, you can make any API call you'd like.
If you have to do everything server-side, Andy Jones is correct, those are the only two ways.
It should be noted, however, that if you can write javascript+jquery code rather than having to do the redirections server-side, you can take advantage of Trello's client.js wrapper, which does exactly what Andy described, but takes care of most of it for you, which is way convenient.
And, as I recently discovered, if you do need to do processing server-side, you can still probably use client.js, then just get the token with Trello.token() in your auth success handler, and pass that to your server-side code. It looks like this: