Skip to content

Commit

Permalink
Bug 813883 - [Facebook] Enable a mechanism to inject test users. r=crdlc
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcanterafonseca committed Nov 21, 2012
1 parent db34cd9 commit f3858eb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/communications/contacts/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"facebookEnabled": true,
"operationsTimeout": 10000,
"logLevel": "DEBUG",
"facebookSyncPeriod": 24
"facebookSyncPeriod": 24,
"testToken": ""
}
1 change: 1 addition & 0 deletions apps/communications/contacts/js/fb/fb_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if (typeof fb.init === 'undefined') {
fb.operationsTimeout = configData.operationsTimeout;
fb.logLevel = configData.logLevel || 'none';
fb.syncPeriod = configData.facebookSyncPeriod || 24;
fb.testToken = configData.testToken;

// The FB Contacts DB Cache is initialized regardless FB is enabled
// or not. That's because we would like to avoid to add extra conditions
Expand Down
15 changes: 15 additions & 0 deletions apps/communications/contacts/js/fb/fb_oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ if (typeof fb.oauth === 'undefined') {
state: state
};

// Enables simple access to test tokens for hacking up the app
// This code will need to be deleted once we have a final product
fb.testToken = fb.testToken || parent.fb.testToken;
if (typeof fb.testToken === 'string' && fb.testToken.trim().length > 0) {
window.console.warn('Facebook. A test token will be used!');
tokenDataReady({
data: {
access_token: fb.testToken,
expires_in: 0,
state: state
}
});
return;
}

asyncStorage.getItem(STORAGE_KEY,
function getAccessToken(tokenData) {
if (!tokenData || !tokenData.access_token) {
Expand Down

0 comments on commit f3858eb

Please sign in to comment.