Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Posts: 4
Registered: ‎07-25-2013
My Device: Blackberry Z10
My Carrier: Rogers

Re: OAuth: Twitter, Facebook & Foursquare Samples!

I had added this as a comment to the blog post, but in the README for the Facebook OAUTH 2.0 Sample, you have following note.  So how should we implement that without disabling websecurity?  We are trying to deploy our app using the internal BES Server, and some users have reported having issue related to this.

 

Thank you,

 

 

Note: While we need to disable web security in order to read the location of our childWindow object, it's recommended that you don't do this in your apps unless absolutely necessary.

BlackBerry Development Advisor
Posts: 762
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: OAuth: Twitter, Facebook & Foursquare Samples!

It's generally a lot easier to just disable web security, but that practice scares some people. If it's not a good option for where you're at, the other option would be to whitelist each domain your app needs to access via the <access> element.

 

More info available here:https://developer.blackberry.com/html5/documentation/code_sample_creating_a_bb_widget_config_documen...

New Contributor
Posts: 4
Registered: ‎07-25-2013
My Device: Blackberry Z10
My Carrier: Rogers

Re: OAuth: Twitter, Facebook & Foursquare Samples!

Thank you, Chad, for quick response.  So is there anything else I need to do other than adding the access uri and the two features tag listed there?

 

I had tried that on the simulator, but the childWindow won't close after authenticating, so I was wondering if I missed something.

BlackBerry Development Advisor
Posts: 762
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: OAuth: Twitter, Facebook & Foursquare Samples!

It's been a while since I last played with the OAuth samples, but I don't believe there's anything else to sort out.

New Contributor
Posts: 4
Registered: ‎07-25-2013
My Device: Blackberry Z10
My Carrier: Rogers

Re: OAuth: Twitter, Facebook & Foursquare Samples!

Great!  Thank you!

New Contributor
Posts: 4
Registered: ‎07-25-2013
My Device: Blackberry Z10
My Carrier: Rogers

Re: OAuth: Twitter, Facebook & Foursquare Samples!

I just tried access uri out with all the domains included, but unfortunatley, I am getting following error:

 

Unsafe JavaScript attempt to access frame with URL [Login URL] from frame with URL local:///index.html. Domains, protocols and ports must match.

 

Any idea how to resolve this?

 

Also, I was wondering if you can clear up one point.  Is it really the case that the signed package cannot have websecurity disabled?  Based on the error report from the users and based on this documentation, this seems to be the case, but I just want to confirm that this is the source of the initial error.

Highlighted
BlackBerry Development Advisor
Posts: 762
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: OAuth: Twitter, Facebook & Foursquare Samples!

Yes, you can have web security disabled completely. 

 

If you're running into issues like this, I would just disable web security entirely in the config.xml.  It can be tricky with some services to whitelist all of the domains separately, and then hoping that the service's domain doesn't change in the future and break compatibility with your app.

Developer
Posts: 366
Registered: ‎07-15-2013
My Device: blackberry Z10
My Carrier: Personal

Re: OAuth: Twitter, Facebook & Foursquare Samples!

i was looking this , thanks

If you find this information useful please click like --->
@mezeitune on twitter
Regular Contributor
Posts: 91
Registered: ‎10-27-2010
My Device: Passport SQW100-1
My Carrier: Meteor

Re: OAuth: Twitter, Facebook & Foursquare Samples!

I upgraded today to webworks sdk 2 beta and my app is full with errors now, in debug modes i see:

 

 

TypeError: 'undefined' is not an object (evaluating 'childWindow.window.location') app.js:185
TypeError: 'undefined' is not an object (evaluating 'currentURL.indexOf') app.js:187
 
When i try to login with facebook.
 
Line 185: var currentURL = childWindow.window.location.href;
Line 187: var inCallback = currentURL.indexOf(callbackURL);
 
 
 
 
BlackBerry Development Advisor
Posts: 762
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: OAuth: Twitter, Facebook & Foursquare Samples!

Hello,

 

I converted the OAuth sample over for the new WebWorks. Can you take a look at the new sample? There are a few changes, but overall pretty minimal.

 

https://github.com/blackberry/BB10-WebWorks-Samples/tree/WebWorks-2.0/OAuth-Facebook