Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Professional Java for Web Applications
BOOK: Professional Java for Web Applications
This is the forum to discuss the Wrox book Professional Java for Web Applications by Nicholas S. Williams; ISBN: 978-1-118-65646-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Java for Web Applications section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 3rd, 2014, 03:44 AM
Authorized User
Join Date: Apr 2014
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 28 - Redirect URL for mobile App

Hi to all,
i'm trying to use the Rest Web Service built in the last chapter.

From iOS, i have requested the auth code and next clicked on "Accept" (like the client described in the same chapter").

Now, the chapter use as redirect url localhost:8080/client/support but, for example, if i would like to call this from an iOS App, what redirect url i should use?

I really dont understand this.

After having an "code", i dont have to call oauth/token with that code ?

If i call oauth/token, (with the code), the server reply me that i need a full authentication.....

I dont understand that step. Could someone help me?
Old May 4th, 2014, 07:54 AM
Authorized User
Join Date: Apr 2014
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

Someone have successfully used this application for example using RESTClient from Firefox ?

Using it with that client (or with other client) the error is:

<oauth><error_description>Full authentication is required to access this resource</error_description><error>unauthorized</error></oauth>

ps: but the author read this forum ??
Old June 11th, 2014, 11:50 PM
Wrox Author
Join Date: Jun 2014
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts


My apologies, but I finally have alerts set up for this forum. I should be able to follow it more closely now.

You can only use RESTClient (and similar tools) without OAuth. Once you add OAuth, you need a more complex testing tool (like a sample client) to use a protected web service. This is why the sample code for the chapter includes a standalone sample client intended to be used to test the web service.

As for using the web service from iOS, you'll need to make a few minor tweaks. First, for your iOS app, you'll need to register with iOS a unique URI scheme that indicates to the OS that your app should be opened when that URI is triggered. For example, the URI scheme for the Twitter app is "twitter://." I am not an iOS developer, so I couldn't tell you how to register this URI scheme.

Once you've done this, you'll need to add the iOS app client redirect URI to the WebServiceClient_RedirectUri database table. The default URI, as you pointed out, is http://localhost:8080/client/support (to which the authorization server will append the necessary parameters). Assuming the URI scheme you register with iOS is "myApp://" (that's a sample only), you could set the URI in the WebServiceClient_RedirectUri table to "myApp://oauth" or something similar.

Finally, whatever URI you put in the WebServiceClient_RedirectUri, you need to make sure your client includes the exact same URI in its initial forward to the authorization server.

This should get you going. Good luck working with this!
-- Nick Williams
Old November 3rd, 2014, 09:33 AM
Authorized User
Join Date: Apr 2014
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Nick,

many thanks for your reply. What you say is exactly what i've already implemented :-)

The question that i havent already solved is posted here: Spring OAuth2 wrong redirect page

"Oauth2 wrong redirect page".

Thanks you again and... nice book!

Similar Threads
Thread Thread Starter Forum Replies Last Post
URL Redirect based on given URL somnath.kartic VS.NET 2002/2003 1 August 2nd, 2012 08:21 AM
Redirect Url itHighway Classic ASP Basics 0 December 31st, 2009 10:50 AM
URL Redirect Help david29118 Classic ASP Basics 3 April 3rd, 2005 06:09 PM
file transfers over mobile asp.net web app badgolfer ASP.NET 1.0 and 1.1 Basics 1 November 15th, 2004 11:33 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.