AuthorizationCodeInstalledApp should not use java.awt.Desktop
See original GitHub issueAuthorizationCodeInstalledApp uses java.awt.Deskopt to start an external webbrowser for user authentication. However, this renders authentication impossible in JavaFX applications as the application just freezes and no external browser window is opened. In JavaFX, for example, WebView might be preferable over an external browser. In general, it is preferable to not have to pull in awt classes when running JavaFX code.
One way around this would be to pass a handler to AuthorizationCodeInstalledApp to allow the caller to decide how to browse a URL.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
authorization - Unable to resolve java.awt.Desktop in ...
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Desktop; at com.google.api.client.extensions.java6.auth.oauth2.
Read more >Uses of Package java.awt.desktop (Java SE 15 & JDK 15)
Contains all of the classes for creating user interfaces and for painting graphics and images. · Provides interfaces and classes for interaction with...
Read more >com.google.api.client.extensions.java6.auth.oauth2 ...
AuthorizationCodeInstalledApp maven / gradle build tool code. ... Preconditions; import java.awt.Desktop; import java.awt.Desktop.Action; import java.io.
Read more >Using OAuth 2.0 with the Google API Client Library for Java
Purpose: This document explains how to use the GoogleCredential utility class to do OAuth 2.0 authorization with Google services.
Read more >Java Examples for java.awt.Desktop.Action - Javatips.net
This java examples will help you to understand the usage of java.awt. ... isDesktopSupported()) { System.err.println("Desktop is not supported (fatal)"); ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@mavrovgeorgi https://github.com/googleapis/google-oauth-java-client/pull/182 introduced a
Browserinterface that allows the caller to use a different way to open a browser than the standardawtway. I suggest you have a closer look at the changes in the PR.Further to what @hanslovsky has suggested - you can do something like this (code is in kotlin)
And this should be done on a background thread: