Instead of keeping keys in my application I intent to read the keys from local file system into a variable (array of strings) and use those array elements in my oAuth APIs. However, when i used keys (in plaintext) as argument to OAuth APIs, authentication succeeds. BUT authentication failed when same value in read into a variable from file & that variable is passed to OAuth API.
Tried comparing the key value and variable value t find out they don't match though they same exactly same.
Input file looks as below:
key_file = open('/Users/homie/.keys', 'r+')
for key in range(1,5):
print (secret_keys == "jFOMZ0bI60fDAEKw53lYCj2r4")
strip the key that you read from the file, as it has a trailing
print(secret_keys.strip() == "jFOMZ0bI60fDAEKw53lYCj2r4")
Or do it when reading it:
for key in range(1,5): secret_keys.append(key_file.readline().split("=").strip())