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

Adobe AIR Development

Reply
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T
Accepted Solution

Protocol Scheme Url on Playbook?

Hi,

I am developing a Soundcloud application, which utilizes oAuth2 as its authentication service. It works by opening a webpage with login fields, and then if the user's credentials are correct, it proceeds to a specified redirect_uri. This is a url that takes the user back into the application. Android and iOS devices utilize something called a protocol scheme, which is a handle back into the apps. For example, 'myApp://parameter' which would be used as a url to navigate back into the app.

 

Is there any such url availble to use with AIR on the tablet sdk? If not, how should I go about this? The user must be authenticated.

 

Here are the soundcloud docs...

http://developers.soundcloud.com/docs#authentication

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: Protocol Scheme Url on Playbook?

[ Edited ]

The easiest way is to use an embedded browser (e.g. StageWebView) for the authorization, and listening for navigation events. If the navigation destination URL is your redirect URL, then the OAuth flow is done and you can grab your token from the URL parameters, cancel the navigation and remove the browser.

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: Protocol Scheme Url on Playbook?

Well I have been using StageWebView to open up the login page, and have been using navigation event listeners to trigger on changes, all just as you described.

However, how exactly would I go about getting the parameter from the url?

 

Thanks for reply!

Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: Protocol Scheme Url on Playbook?

K so i just inspected the source property of the StageWebView instance I had, and it appears to remain the same even going to the redirect_uri. This is because the initial url I gave it had a 'redirect_uri' parameter in it that the login page loads after authorization, but the actualy url of the stageWebView does not change.
Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: Protocol Scheme Url on Playbook?

Listen for the LocationChangeEvent.LOCATION_CHANGING event on StageWebView. Your handler is passed a LocationChangeEvent parameter. It has a location property...

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: Protocol Scheme Url on Playbook?

Yeah like I said, its never triggering that event listener, because the location never changes, at least looking in from the outside. Somehow its all done within some frame or something in the page.

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: Protocol Scheme Url on Playbook?

I assume you using the "User Agent Flow" variant of OAuth2. If they return the token by loading a URL inside an iframe, that's not OAuth2 compatible...

 

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: Protocol Scheme Url on Playbook?

OAuth2 compatible.. meaning?
I'm not sure what to do at this point.
Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: Protocol Scheme Url on Playbook?

If that is the case, StageWebView would give you an error when trying to load the redirect_uri "myApp://parameter"... Do you get that error?

 

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: Protocol Scheme Url on Playbook?

Btw, went back to this post and tried it again. For some reason, only worked when I used
LocationChangeEvent.LOCATION_CHANGE
but nonetheless worked in the end. Thanks!
Please use plain text.