Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verification failure #5

Open
Alphatiger opened this issue Sep 28, 2015 · 9 comments
Open

Verification failure #5

Alphatiger opened this issue Sep 28, 2015 · 9 comments

Comments

@Alphatiger
Copy link

App integration is done successfully,
Receiving token, but when trying to verify getting 215 bad authentication data. Compared the generated oauth Echo with that of digits web example cannonball, had observed for oauth signature character encoding is missing,

Any suggestions please

@yangli-io
Copy link
Owner

Hmm not sure how I can help you without seeing what you've done

@Alphatiger
Copy link
Author

Hi I got it
The problem is with oauth_signature it is having special characters like + and =, and when i am passing them as Headers it is breaking, once i applied the uriencoding it was good.

In order to do this i have applied some crude code, can we improve the plugin to send us back the login response in proper json format so that it will be easy, right now 'X-Verify-Credentials-Authorization' is a long string to extract oauth and apply encoding requires string split etc, if you have any better way of handling please let me know.

@nibhatish
Copy link

@Alphatiger , I am facing the same issue. Can you please share code sample to demonstrate, how you fixed it.

@nitin7dc
Copy link

nitin7dc commented Dec 1, 2015

facing same issue

@nibhatish
Copy link

@nitin7dc Following worked for me. Called digitLoginSuccess function with loginResponse from Digit.
function digitLoginSuccess(loginResponse){
// alert(JSON.stringify(loginResponse));
var oAuthHeaders = loginResponse.oauth_echo_headers;
var verifyData = {
authHeader: oAuthHeaders['X-Verify-Credentials-Authorization'],
apiUrl: oAuthHeaders['X-Auth-Service-Provider']
};
console.log(verifyData.apiUrl);
console.log(verifyData.authHeader);
// all the following code is required to encodeURI signature part of Authorization. We first, have to split , then encode and
// then again join the string to make it original
var strinput = verifyData.authHeader;
var tempStringSignature = 'oauth_signature="';
var tempStringSignatureMethod = '", oauth_signature_method=';
var encodedCredentials="";
var tempSplit1 = strinput.split(tempStringSignature);
var tempSplit2 = tempSplit1[1].split(tempStringSignatureMethod);
var strSignature = encodeURIComponent(tempSplit2[0]);
encodedCredentials = tempSplit1[0] + tempStringSignature + strSignature + tempStringSignatureMethod + tempSplit2[1];

      }

@nitin7dc
Copy link

nitin7dc commented Dec 1, 2015

@nibhatish this solves the issue, thanks for such an early response!

@djvickx
Copy link

djvickx commented May 10, 2016

Hello @nibhatish, You have no idea how badly I was looking for a solution to this error Bad Authentication Data. I was integrating digits for web with backend in PHP. I haven't found information about this encoding anywhere, not even in twitter documents.
BTW how did you find out about it? That we need to encode oauth_signature before sending request to digits server.

Many Thanks,
Waqas

@yangli-io
Copy link
Owner

@djvickx just a random question, is this digits-cordova package still working for you? It's been a while since I've used this, not sure if twitter has changed how it works.

@nibhatish
Copy link

@djvickx I also lost some hairs while finding the solution :-). I followed the comment of @Alphatiger about how to fix it and just translated his suggestions in javascript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants