HI Katya,
I tried running the new redirectUrl on the Homescreen page and then the Javascript code on the voutchescore page but I'm still getting errors.
Here's what I have on the homescreen button click event:
var redirectUrl = window.location.href;
redirectUrl = redirectUrl.replace( /(#.+)$/, '' );
var url = 'https://www.facebook.com/dialog/oauth...';
url += '&redirect_uri=' + redirectUrl;
url += '&scope=read_stream,user_about_me,user_birthday,user_checkins,user_hometown,user_interests,user_likes, user_location,user_photos,user_relationships,user_relationship_details,user_religion_politics,user_status, user_website,user_education_history,user_work_history, user_relationships, user_religion_politics ';
url += '&state='+OAuth.nonce(17);
var cb = null;
if(window.plugins) {
cb = window.plugins.childBrowser;
}
if (cb != null) {
/* Wen native childBrowser plugin must be used to navigate to facebook. /
cb.onLocationChange = function (url) {
if(url.indexOf(redirectUrl) === 0) {
/ if user successfully logged in /
cb.close();
var vars = parseUrlVars(url);
localStorage.setItem('code', vars.code + '_'); / store secret code /
Appery.navigateTo('result', {reverse: false}); / Navigate to page 'result' */
}
};
}
else {
localStorage.setItem('code', '');
window.open(url);
};