_uri = do
  isTestMode ← getConfOpt testMode
  guardBool errWrongAuth isTestMode
  let reduri = fromMaybe "" redirect_uri
  throwM err302 { errHeaders = [ (hLocation, cs $ reduri ++ (if "?" `isInfixOf` reduri then "&" else "?") ++
    "state=" ++ fromMaybe "" state ++ "&code=test") ] }


errNoAuth ∷ ServantErr
errNoAuth = errText err401 "Authorization/access_token not found."

errWrongAuth ∷ Servant
getTestLogin ∷ Maybe Text → Maybe Text → Maybe Text → Sweetroll NoContent
getTestLogin host state redirect_uri = do
  isTestMode ← getConfOpt testMode
  guardBool errWrongAuth isTestMode
  let reduri = fromMaybe "" redirect_uri
  throwM err302 { errHeaders = [ (hLocation, cs $ reduri ++ (if "?" `isInfixOf` reduri then "&" else "?") ++
    "state=" ++ fromMaybe "" state ++ "&code=test") ] }
getTestLogin host state redirect_uri = do
  isTestMode ← getConfOpt testMode
  guardBool errWrongAuth isTestMode
  let reduri = fromMaybe "" redirect_uri
  throwM err302 { errHeaders = [ (hLocation, cs $ reduri ++ (if "?" `isInfixOf` reduri then "&" else "?") ++
    "state=" ++ fromMaybe "" state ++ "&code=test") ] }