okta-sdk-appauth-android icon indicating copy to clipboard operation
okta-sdk-appauth-android copied to clipboard

"Network Error" when properly configured

Open Speediing opened this issue 6 years ago • 6 comments

I have my Setup configured exactly as the readMe says and I am calling this:

    mOktaAuth!!.login(
            this,
            PendingIntent.getActivity(this, 0, completionIntent, 0),
            PendingIntent.getActivity(this, 0, cancelIntent, 0)
    )

I am instead getting a response in the logs that says:

2018-12-13 10:40:18.520 9573-9573E/OktaAppAuth: Failed to retrieve discovery document AuthorizationException: {"type":0,"code":3,"errorDescription":"Network error"}

After doing a network trace it reveals that the network request comes back correctly with a 200 response. What is going wrong?

Speediing avatar Dec 17 '18 15:12 Speediing

That is odd. A few quick questions:

  • Does the URL you've configured for issuer_uri end with /oauth2/default?
  • If you append /.well-known/openid-configuration to the URL and visit it in your browser, do you see a JSON document?

nbarbettini avatar Dec 18 '18 03:12 nbarbettini

@nbarbettini Yes my issuer uri ends with that and yes I get a JSON document when I visit there

Speediing avatar Dec 18 '18 14:12 Speediing

@Speediing Was able to duplicate this on sdk 16 (4.1) produced an issue related to SSL handshake. Moving to 21 (5.0) seems to work around SSL issue.

E/AppAuth: Network error when retrieving discovery document
    javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb7e002c0: Failure in SSL library, usually a protocol error
    error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x9e135925:0x00000000)
...
Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb7e002c0: Failure in SSL library, usually a protocol error
    error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x9e135925:0x00000000)
        at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
...
E/OktaAppAuth: Failed to retrieve discovery document
    AuthorizationException: {"type":0,"errorDescription":"Network error","code":3}

imbradbrown avatar Dec 20 '18 16:12 imbradbrown

My min SDK is 21

Speediing avatar Dec 20 '18 20:12 Speediing

@Speediing did you call init() on OtaAppAuth instance before calling login() ?

sergiymokiyenko-okta avatar Jan 10 '19 10:01 sergiymokiyenko-okta

@sergiymokiyenko-okta Yes I did mOktaAuth = OktaAppAuth.getInstance(this); mOktaAuth!!.init( this, object : OktaAppAuth.OktaAuthListener { override fun onSuccess() { } override fun onTokenFailure(ex: AuthorizationException) { } })

Speediing avatar Jan 16 '19 14:01 Speediing