okta-sdk-appauth-android
okta-sdk-appauth-android copied to clipboard
"Network Error" when properly configured
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?
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 Yes my issuer uri ends with that and yes I get a JSON document when I visit there
@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}
My min SDK is 21
@Speediing did you call init()
on OtaAppAuth instance before calling login()
?
@sergiymokiyenko-okta Yes I did
mOktaAuth = OktaAppAuth.getInstance(this); mOktaAuth!!.init( this, object : OktaAppAuth.OktaAuthListener { override fun onSuccess() { } override fun onTokenFailure(ex: AuthorizationException) { } })