function createAuthProvider(firebase, providerName, scopes) {
  // TODO: Verify scopes are valid before adding
  // TODO: Validate parameter inputs

  const lowerCaseProviderName = providerName.toLowerCase()

  if (
    lowerCaseProviderName === 'microsoft.com' ||
    lowerCaseProviderName === 'apple.com' ||
    lowerCaseProviderName === 'yahoo.com'
  ) {
    const provider = new firebase.auth.OAuthProvider(providerName)
    return provider
  }

  const capitalProviderName = `${capitalize(providerName)}AuthProvider`

  // Throw if auth provider does not exist on Firebase instance
  if (!firebase.auth[capitalProviderName]) {
    throw new Error(
      `${providerName} is not a valid auth provider for your firebase instance. If using react-native, use a RN specific auth library.`
    )
  }

  const provider = new firebase.auth[capitalProviderName]()

  // Custom Auth Parameters
  // TODO: Validate parameter inputs
  const { customAuthParameters } = firebase._.config
  if (customAuthParameters && customAuthParameters[providerName]) {
    provider.setCustomParameters(customAuthParameters[providerName])
  }

  // Handle providers without scopes
  if (
    lowerCaseProviderName === 'twitter' ||
    typeof provider.addScope !== 'function'
  ) {
    return provider
  }

  // TODO: Verify scopes are valid before adding
  provider.addScope('email')

  if (scopes) {
    if (Array.isArray(scopes)) {
      scopes.forEach((scope) => {
        provider.addScope(scope)
      })
    }
    // Add single scope if it is a string
    if (typeof scopes === 'string' || scopes instanceof String) {
      provider.addScope(scopes)
    }
  }

  return provider
}
@description Get correct login method and params order based on provided credentials
@param {object} firebase - Internal firebase object
@param {string} providerName - Name of Auth Provider (i.e. google, github, facebook, twitter)
@param {Array|string} scopes - List of scopes to add to auth provider
@returns {firebase.auth.AuthCredential} provider - Auth Provider
@private