You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iceraven-browser/app/src/main/java/org/mozilla/fenix/components/FxaServer.kt

30 lines
1013 B
Kotlin

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.components
import android.content.Context
import mozilla.components.service.fxa.ServerConfig
import mozilla.components.service.fxa.ServerConfig.Server
import org.mozilla.fenix.FeatureFlags
/**
* Utility to configure Firefox Account servers.
*/
object FxaServer {
const val CLIENT_ID = "a2270f727f45f648"
const val REDIRECT_URL = "https://accounts.firefox.com/oauth/success/$CLIENT_ID"
@Suppress("ConstantConditionIf", "UNUSED_PARAMETER")
fun redirectUrl(context: Context) = if (FeatureFlags.asFeatureWebChannelsDisabled) {
REDIRECT_URL
} else {
"urn:ietf:wg:oauth:2.0:oob:oauth-redirect-webchannel"
}
fun config(context: Context): ServerConfig {
return ServerConfig(Server.RELEASE, CLIENT_ID, redirectUrl(context))
}
}