I use doorkeeper as a oauth2 provider https://github.com/applicake/doorkeeper . It works like this: 1. App opens webView and shows login screen 2. User signs in 3. Application sends grant code request to an auth. server 4. Now it should redirect from authorization server back to a client and it sends grant code in uri. It fails on iPhone so I have to get the grant code from error message, and it shows "page not found" on android and I can grab code from url. But I'm not sure if this is prefered way of doing oauth2 client. Can anyone help me with that issue?
2 Answers
There are two ways:
- the webview shows the user after successfull login a pin. You open a text field, the user writes the pin in textfield and you send a fetchAccessToken with this pin to oauth server
- The oauth server does't use pin. In this case it givesyou in a redirect URL a oauth-verfier. It is the same pin. You parse it an make this call above.
Good lib: jsoauth from Rob Griffith
Hope this helps.
Rainer
Thank you for your answer. I have found way ho to extract grant code from redirect url on iPhone and on Android as well. It works now, but it is still incomplete that's why I've decided to make this oauth module open source to make it really stable and universal with the help of contributors. It would be cool if someone could help me with it. https://github.com/OrganisedMinds/titanium-oauth2-client
Your Answer
Think you can help? Login to answer this question!