Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hardcode login credentials in c# for trello api

I've been using trello.net api for trello to read through the boards etc.

I've been using the trello.GetAuthorizationUrl(); to redirect the user to a login page for trello although I'm looking for an option where I can just hard code my login credentials into the C# code.

Let me know if anyone has done that or knows how to.

like image 673
user1969145 Avatar asked Jan 11 '13 07:01

user1969145


People also ask

What hardcoded credentials?

Hard-coding credentials is the software development practice of embedding authentication data -- user IDs and passwords -- directly into the source code of a program or other executable object. This is as opposed to obtaining the credentials from external sources or generating them at runtime.

What is the mitigation for hard-coded credentials vulnerability?

Developers must avoid hardcoding sensitive data, users must be forced to use strong passwords and it is recommended to store sensitive data such as passwords using strong adaptive and salted hashing functions with a work factor (delay factor), such as Argon2, scrypt, bcrypt or PBKDF2.

What is Hardcode in C#?

Hardcoding is when you directly give a value instead of using a variable. Variables can be re-used at different locations in your code.

Are hard-coded credentials that are located in connection strings OK?

Including unencrypted hard-coded inbound or outbound authentication credentials within source code or configuration files is dangerous because the credentials may be easily discovered.


1 Answers

Instead of hardcoding the credentials, you could hardcode the token.

Visit this url (replace some parameters first):

https://trello.com/1/authorize?key=substitutewithyourapplicationkey&name=My+Application&expiration=never&response_type=token&scope=read,write

Hardcode the token you get back and do:

trello.Authorize(hardcodedToken);

(Or you can have Trello.NET generate that url using trello.GetAuthorizationUrl() but since you're only doing this once, I see no point).

How to authorize a client (from Trello documentation).

like image 155
dillenmeister Avatar answered Oct 21 '22 11:10

dillenmeister