Comments (9)
Hmm not sure how I can help you without seeing what you've done
from digits-cordova.
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.
@Alphatiger , I am facing the same issue. Can you please share code sample to demonstrate, how you fixed it.
from digits-cordova.
facing same issue
from digits-cordova.
@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.
@nibhatish this solves the issue, thanks for such an early response!
from digits-cordova.
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.
@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.
@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)
- Does not work on web? HOT 1
- require is not defined HOT 1
- Not returning back after success HOT 1
- Integration question HOT 9
- require is undefined HOT 1
- Security issue HOT 3
- PhoneGAP - Themes? HOT 1
- Sucesscall back HOT 12
- Error : Something is technically wrong on Digits HOT 3
- I am using Cordova / Ionic for creating a hybrid app. Which consumer key should I use. HOT 2
- Digits Asking for signup
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from digits-cordova.