3

I'm writing a micro-service that permits to create a user on my backend from valid credentials provided by Fabric Digits.

I get the credentials from the Digits iOS SDK on my iOS client with this code:

Digits *digits = [Digits sharedInstance];
DGTOAuthSigning *oauthSigning = [[DGTOAuthSigning alloc] initWithAuthConfig:digits.authConfig authSession:digits.session];
NSDictionary *authHeaders = [oauthSigning OAuthEchoHeadersToVerifyCredentials];  

And I past the content of authHeaders[@"X-Verify-Credentials-Authorization"] in the following curl request:

curl --get 'https://api.twitter.com/1.1/account/verify_credentials.json' --header 'Authorization: OAuth oauth_signature="xxxx",oauth_nonce="xxxx",oauth_timestamp="1449582920",oauth_consumer_key="xxxx",oauth_token="xxxx",oauth_version="1.0",oauth_signature_method="HMAC-SHA1"' --verbose

Unfortunately, I get this error as a response from Twitter API:

{"code":32,"message":"Could not authenticate you."}

I found other threads on SO with this problem, but none of the answers helped me.

Any suggestions?

Jean Lebrument
  • 5,079
  • 8
  • 33
  • 67
  • did you find anything or not ?? please reply i am also stuck in this same problem – aman verma Jan 20 '16 at 21:33
  • https://twittercommunity.com/t/verify-credentials-provided-by-fabric-digits-on-server-side-return-error-32-could-not-authenticate-you/57682 – Jean Lebrument Jan 21 '16 at 09:43
  • also can you please tell me in order to verify mobile number through digits , do i have to have a twitter account associated with that mobile number or not ?? i was wondering this because when i user GET verify_credentials then it returns user_id, now i was wondering that if my mobile number is not linked with twitter then what will be the user_id in the response ?? also one more thing is there any way possible by which twitter will send the mobile number in response ?? Thank you – aman verma Jan 22 '16 at 00:20
  • No need to have a twitter account associated. I guess the user_id is the one set by Digits for a specific phone number. Regarding your last question, I don't think that the Twitter API provides such a method, Digits does though. – Jean Lebrument Jan 22 '16 at 12:56
  • but in verify_creentials how to know which of my number if being authenticated, i mean as it does not send mobile number in response also second question suppose i have mobile number 1234567890 and u have 987654321 now suppose you have change your number to my number on twitter which is 1234567890 now my question is does user_id associated for 1234567890 which is now your number change. (I mean when i was using 1234567890 then user_id is suppose "abssggdd" now for you will it be same or change because for my usecase it must not change) please reply must :) – aman verma Jan 22 '16 at 18:13

1 Answers1

2

Don't use https://api.twitter.com/1.1/account/verify_credentials.json url for sending authorization headers use this https://dev.twitter.com/rest/reference/get/account/verify_credentials i was having same problem but now it s working completely fine please let me know whether it is working for you now or not.

Sudhanshu Gaur
  • 7,486
  • 9
  • 47
  • 94