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 21 forks source link

StandardWidgetTool failed to get Authorization Code on RHEL 7.2 with OpenJDK #32

Open yacaovsnc opened 8 years ago

yacaovsnc commented 8 years ago

@leantk ran into this problem today on her RHEL 7.2 box. The SWT browser came up fine and works against MSA backed account. However when she tries to login with her work email address, SWT throws this stack trace when it should prompt for 2FA:

com.microsoft.alm.oauth2.useragent.AuthorizationException: Code: unknown_error Description: openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

                at com.microsoft.alm.oauth2.useragent.AuthorizationResponse.fromString(AuthorizationResponse.java:109)
                at com.microsoft.alm.oauth2.useragent.UserAgentImpl.encode(UserAgentImpl.java:190)
                at com.microsoft.alm.oauth2.useragent.UserAgentImpl.requestAuthorizationCode(UserAgentImpl.java:150)
                at com.microsoft.alm.auth.oauth.AzureAuthority.acquireAuthorizationCode(AzureAuthority.java:282)
                at com.microsoft.alm.auth.oauth.AzureAuthority.acquireToken(AzureAuthority.java:223)
                at com.microsoft.alm.auth.oauth.OAuth2Authenticator$1.doRetrieve(OAuth2Authenticator.java:181)
                at com.microsoft.alm.auth.oauth.OAuth2Authenticator$1.doRetrieve(OAuth2Authenticator.java:157)
                at com.microsoft.alm.auth.BaseAuthenticator$SecretRetriever.retrieve(BaseAuthenticator.java:217)
                at com.microsoft.alm.auth.oauth.OAuth2Authenticator.getOAuth2TokenPair(OAuth2Authenticator.java:208)
                at com.microsoft.alm.auth.pat.VstsPatAuthenticator$1.doRetrieve(VstsPatAuthenticator.java:141)
                at com.microsoft.alm.auth.pat.VstsPatAuthenticator$1.doRetrieve(VstsPatAuthenticator.java:138)
                at com.microsoft.alm.auth.BaseAuthenticator$SecretRetriever.retrieve(BaseAuthenticator.java:217)
                at com.microsoft.alm.auth.pat.VstsPatAuthenticator.getToken(VstsPatAuthenticator.java:157)
                at com.microsoft.alm.auth.pat.VstsPatAuthenticator.getPersonalAccessToken(VstsPatAuthenticator.java:112)
                at com.microsoft.alm.provider.JaxrsClientProvider.getClient(JaxrsClientProvider.java:109)
                at com.microsoft.alm.auth.sample.App.main(App.java:72)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

She tries the same work email login on my RHEL 6.7 VM with the same OpenJDK 8 (1.8.0_91) version, and SWT works fine, she sees the 2FA.

Looks like this is a problem on RHEL 7.2.

yacaovsnc commented 8 years ago

I reproduced this error on a RHEL 72 VM. It appears SWT crashed:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f9fc4585a10, pid=8513, tid=140325958321920
#
# JRE version: OpenJDK Runtime Environment (8.0_91-b14) (build 1.8.0_91-b14)
# Java VM: OpenJDK 64-Bit Server VM (25.91-b14 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libwebkitgtk-3.0.so.0+0x45aa10]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/yacao/Repo/vsts-authentication-library-for-java/hs_err_pid8513.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

When this JVM crashes, it sent

openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

to stderr, and the crash report to stdout. Hence we got a non-descriptive error message in the reported stacktrace.

sigmadeltasoftware commented 3 years ago

Hey @yacaovsnc, sorry for bumping this topic and being a few years late, but I'm experiencing a similar issue integrating this library into a project and authenticating using the Twitch API.

Can you recall if (and preferably how) you've resolved this issue? Thanks in advance!