microsoft / oauth2-useragent

Microsoft OAuth 2.0 User Agent library for Java. Provides classes to facilitate the implementation of "4.1. Authorization Code Grant" from RFC 6749.
Other
35 stars 22 forks source link

Browser window is inactive - Can't retrieve an authorization code #48

Open FJBDev opened 4 years ago

FJBDev commented 4 years ago

Hello, I have just discovered this library and was hoping to be able to use it.

The issue that I am encountering is the following : I have created a sample code to retrieve an authorization code from the Dropox API (see code below).

 final UserAgent userAgent = new UserAgentImpl();
      AuthorizationResponse authorizationResponse;
      try {
         final URI authorizationEndpoint = new URI("https://www.dropbox.com/oauth2/authorize?" +
               "client_id=MYCLIENTID" +
               "&response_type=code" +
               "&force_reapprove=true");
         final URI redirectUri = new URI("");
         authorizationResponse = userAgent.requestAuthorizationCode(authorizationEndpoint,
               redirectUri);
         final String code = authorizationResponse.getCode();
         System.out.print("Authorization Code: ");
         System.out.println(code);
      } catch (final AuthorizationException | URISyntaxException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }

Once the browser window is loaded, if I enter my Dropbox credentials or if I use Google to authenticate myself, clicking on the Login button or Next doesn't trigger anything.

image

I don't see any exceptions being raised.

Thanks