Support SSO login with Firefox account (#606)

This commit is contained in:
Benoit Marty 2020-02-05 15:18:03 +01:00
parent 3189c114dc
commit 2a4c8b3199
2 changed files with 8 additions and 8 deletions

View file

@ -9,7 +9,7 @@ Improvements 🙌:
- Improve network detection. It is now based on the sync request status (#873, #882)
Other changes:
-
- Support SSO login with Firefox account (#606)
Bugfix 🐛:
- Ask for permission before opening the camera (#934)

View file

@ -83,6 +83,10 @@ class LoginWebFragment @Inject constructor(
private fun setupWebView(state: LoginViewState) {
loginWebWebView.settings.javaScriptEnabled = true
// Enable local storage to support SSO with Firefox accounts
loginWebWebView.settings.domStorageEnabled = true
loginWebWebView.settings.databaseEnabled = true
// Due to https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html, we hack
// the user agent to bypass the limitation of Google, as a quick fix (a proper solution will be to use the SSO SDK)
loginWebWebView.settings.userAgentString = "Mozilla/5.0 Google"
@ -90,7 +94,7 @@ class LoginWebFragment @Inject constructor(
// AppRTC requires third party cookies to work
val cookieManager = android.webkit.CookieManager.getInstance()
// clear the cookies must be cleared
// clear the cookies
if (cookieManager == null) {
launchWebView(state)
} else {
@ -225,12 +229,8 @@ class LoginWebFragment @Inject constructor(
val action = javascriptResponse.action
if (state.signMode == SignMode.SignIn) {
try {
if (action == "onLogin") {
javascriptResponse.credentials?.let { notifyViewModel(it) }
}
} catch (e: Exception) {
Timber.e(e, "## shouldOverrideUrlLoading() : failed")
if (action == "onLogin") {
javascriptResponse.credentials?.let { notifyViewModel(it) }
}
} else {
// MODE_REGISTER