Changed SSO redirect URI scheme, updated default SSO URI, delete saved config in case of token refresh error before retrying

This commit is contained in:
Sylvain Berfini 2024-02-15 17:09:09 +01:00
parent bfd5a8f6fa
commit f93e771bab
2 changed files with 11 additions and 4 deletions

View file

@ -174,7 +174,7 @@ dependencies {
implementation 'com.google.firebase:firebase-crashlytics-ndk'
implementation 'net.openid:appauth:0.11.1'
android.defaultConfig.manifestPlaceholders = [appAuthRedirectScheme: 'org.linphone.sso']
android.defaultConfig.manifestPlaceholders = [appAuthRedirectScheme: 'org.linphone']
//noinspection GradleDynamicVersion
implementation 'org.linphone:linphone-sdk-android:5.4.+'

View file

@ -49,10 +49,10 @@ class OpenIdActivity : GenericActivity() {
companion object {
private const val TAG = "[Open ID Activity]"
private const val WELL_KNOWN = "https://auth.linphone.org:8443/realms/sip.linphone.org/.well-known/openid-configuration"
private const val WELL_KNOWN = "https://sso.onhexagone.com//realms/ONHEXAGONE/.well-known/openid-configuration"
private const val CLIENT_ID = "account"
private const val SCOPE = "openid email profile"
private const val REDIRECT_URI = "org.linphone.sso:/openidcallback"
private const val REDIRECT_URI = "org.linphone:/openidcallback"
private const val ACTIVITY_RESULT_ID = 666
}
@ -187,7 +187,14 @@ class OpenIdActivity : GenericActivity() {
}
updateTokenInfo()
} else {
Log.e("$TAG Failed to perform token refresh [$ex]")
Log.e(
"$TAG Failed to perform token refresh [$ex], destroying auth_state.json file"
)
val file = File(applicationContext.filesDir.absolutePath, "auth_state.json")
lifecycleScope.launch {
FileUtils.deleteFile(file.absolutePath)
singleSignOn()
}
}
}
}