How to implement the authorization code flow using OAuth for the authorization to trelloapi
Asked by Alaa TAHRAOUI:

I'm trying to integrate trelloapi with asp.net app, I followed the instruction mentioned in the following link [Authorization](https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/#authorizing-a-client) and I got my access token successfully using this url (**[https://trello.com/1/authorize?expiration=1day\&name=MyPersonalToken\&scope=read\&response_type=token\&key=\*\*\*](https://trello.com/1/authorize?expiration=1day&name=MyPersonalToken&scope=read&response_type=token&key=***)** ), but the token was as a **fragment** in the return_url (expl: <http://localhost:8080/GetToken>**#token=** ....), and in my case I would like to have the token as **param** (with ? and not #) in the url (<http://localhost:8080/GetToken>**?token=....**) server-side app.

After some research I found that the trelloApi uses implicit flow to authorize the user, that's why the token is as a fragment and to get it as param, I need to use the authorization code flow where the OAuth is needed.

The problem is I didn't find documentations or examples that helps me to implement the authorization flow which means implementing OAuth. I checked [Glitch](https://glitch.com/edit/#!/trello-oauth) project and I implemented it in c# but it doesn't work, it shows messae error "++OAuth consumer did not supply its key++ ", and when I added "oauth_consumer_key" as param, I got an other error message "++Invalid Signature++".

Please I need help in these 2 points:

1- How can I get the access token as param in the url.

2- I need more details about how to implement OAuth (except those 3 urls provided in [Authorization](https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/#authorizing-a-client)).

Thank you in advance


Answers:
author: Mutya A
body: Hi Alaa,

Happy to assist with your query here. The page you shared does not properly explain the steps to take to generate a Trello API key and token for the Trello API so I'm sharing this if it helps:

1. Go to Power-up Admin page: <https://trello.com/power-ups/admin>
2. Create a New Power-Up by clicking the "New" button in the top right of the Power-Up admin portal.
3. Follow the steps on [Adding a New Power-Up](https://developer.atlassian.com/cloud/trello/guides/power-ups/managing-power-ups/#adding-a-new-custom-power-up)
4. Once you already submitted the form to create your Power-Up, you will be taken to the **API Key** tab to [Generate a New API key](https://developer.atlassian.com/cloud/trello/guides/power-ups/managing-power-ups/#generating-an-api-key).
5. On the same page where you found your newly generated API key, click the hyperlinked "Token" at the right of the API key.
6. Once you click Allow you'll grant your own app (identified via your API key) access to your account and be redirected to a page that contains the API token. Here's more info on how to [generate a token](https://developer.atlassian.com/cloud/trello/guides/rest-api/api-introduction/#authentication-and-authorization).

Once you have the Trello API Key and Token you can apply that in your current code. If it still does not work and is giving errors, this would be a really great question to re-share in our Trello developer community. We have a number of Trello Engineers that are active there, and they'd be happy to give some guidance for more advanced topics like these: <https://community.developer.atlassian.com/c/trello>

Hope this helps!  
----  
If this post ***helps*** your query, then please consider **Accept answer** , **Like** or click up arrow to **Vote** to help the other users find it more quickly.

comments: author: Alaa TAHRAOUI
body: Hi Mutya,

Thank you for your answer.

I would like to tell you that my problem is not about how to generate the token, I already did this successfully. Maybe I didn't explain my issue well.

I would like to implement the authorization process using [OAuth](https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/#using-basic-oauth) instead of [route authorization](https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/#1-authorize--route-options) and I could not find enough documentation about it.

I'm looking for OAuth implementation because when I used route authorization, the generated token is returned as fragment in the URL and this case is not what I need, I need the token to be as param in the URL.


author: Mutya A
body: Hi Alaa,

Appreciate the response. As mentioned, this would be a really great question to share in our Trello developer community page. We have a number of Trello Engineers that are active there, and they'd be happy to give some guidance for more advanced topics like these.

You can post your query here: <https://community.developer.atlassian.com/c/trello>


author: Alaa TAHRAOUI
body: Okey then, I appreciate you answer and time.


Tags: .net

api

authentication

authority

fragment

glitch

oauth

token

url