Nima Emrani
Nima Emrani

Reputation: 55

Twitter Rest API not accepting headers for tokens in Swift

I am trying to load a JSON page on the console and I keep getting the error message that I have bad authentication data.

I am using the correct headers that the Twitter Developer program gave me to access the JSON but it's not working. Am I doing something wrong with Alamofire? Do I have the wrong format for the headers? Any help would be appreciated.

code error

Upvotes: 3

Views: 533

Answers (1)

mrkbxt
mrkbxt

Reputation: 491

try the following in-line authorization header format with your values:

let headers = ["Authorization": "OAuth oauth_consumer_key=xvz1evFS4wEEPTGEFPHBog, oauth_nonce=kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg, oauth_signature=tnnArxj06cWHq44gCs1OSKk%2FjLY%3D, oauth_signature_method=HMAC-SHA1, oauth_timestamp=1318622958, oauth_token=370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb, oauth_version=1.0"]

Upvotes: 1

Related Questions