Giter Club home page Giter Club logo

Comments (9)

yangli-io avatar yangli-io commented on August 17, 2024

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

from digits-cordova.

Alphatiger avatar Alphatiger commented on August 17, 2024

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.

from digits-cordova.

nibhatish avatar nibhatish commented on August 17, 2024

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

from digits-cordova.

nitin7dc avatar nitin7dc commented on August 17, 2024

facing same issue

from digits-cordova.

nibhatish avatar nibhatish commented on August 17, 2024

@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];

      }

from digits-cordova.

nitin7dc avatar nitin7dc commented on August 17, 2024

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

from digits-cordova.

djvickx avatar djvickx commented on August 17, 2024

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

from digits-cordova.

yangli-io avatar yangli-io commented on August 17, 2024

@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.

from digits-cordova.

nibhatish avatar nibhatish commented on August 17, 2024

@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.

from digits-cordova.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.