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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Trusted Contributor
AllSystemGo
Posts: 137
Registered: ‎11-23-2010
My Carrier: Rogers

oAuth2 question

[ Edited ]

The app I'm trying to create supports oauth2 and since I'm really new at this I would really appreciate if someone could help me understand what I need to code or how to use the library that Kyle Fowler created.

 

My website needs these parameter to be sent:

 

  • consumer_key
  • redirect_uri

I want to unserstand what is the redirect_uri I need to input. And finally how to I end up with something like that:

 

Example request (x-www-form-urlencoded):

POST /v3/oauth/request HTTP/1.1
Host: 
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Accept: application/x-www-form-urlencoded

consumer_key=1234-abcd1234abcd1234abcd1234&
redirect_uri=myapp1234:authorizationFinished

 

 

Thank you for the help.

Please use plain text.
Developer
Innovatology
Posts: 1,076
Registered: ‎03-03-2011
My Carrier: Vodafone

Re: oAuth2 question

On mobile devices, the easiest way of handling OAuth is by using an embedded web view. In that case, the redirect URI is just a string. Any string. It could be the name of your pet goldfish. Or a randomly generated string. As long as it doesn't occur in the normal oauth dance you're fine. You simply use it to detect when your token has been generated by handling the navigation event of the web view:

 

  • oath process is started in the web view
  • user logs in, grants permission
  • site generates token
  • site redirects to redirect_uri
  • webview fires navigation event
  • your app detects navigation to redirect_uri
  • your app extracts token from redirect_uri
  • your app cancels navigation, removes webview

For historical reasons, the prefix oob:// (meaning out-of-band) is often used, but there is no requirement for that.

 

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
kylefowler
Posts: 479
Registered: ‎05-17-2009
My Carrier: ATT

Re: oAuth2 question

There is an oauth2 sample on my github. http://github.com/kylefowler
Like all of my posts
Please use plain text.
Trusted Contributor
AllSystemGo
Posts: 137
Registered: ‎11-23-2010
My Carrier: Rogers

Re: oAuth2 question

Wow, really great answer thank you. I really appreciate the time you spend on answering my question.
Please use plain text.
Trusted Contributor
AllSystemGo
Posts: 137
Registered: ‎11-23-2010
My Carrier: Rogers

Re: oAuth2 question

Thank you for your post Kyle. Which one is oauth2 sample? I tried the twitter one but I don't think that it uses oauth2. I could be mistaken!
Please use plain text.
Developer
kylefowler
Posts: 479
Registered: ‎05-17-2009
My Carrier: ATT

Re: oAuth2 question

Yeah, twitter uses oauth1. The foursquare one is oauth2 https://github.com/kylefowler/foursquare
Like all of my posts
Please use plain text.
Visitor
tatli
Posts: 1
Registered: ‎02-08-2013
My Carrier: Fido

Re: oAuth2 question

This approach would not work (for "https" uri) at least from my experience. Cascades WebView is not handling redirect_uri properly (whereas browser does it perfectly).
Please use plain text.
Developer
wantoun
Posts: 138
Registered: ‎10-04-2010
My Carrier: alfa

Re: oAuth2 question

I'm having the same problem as tatli with secure content.
I'm trying to use Google's OAuth but I can't load the URLs with HTTPS.
Anyone managed to work around that!?
Wadi
Please use plain text.