You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: auth.rs
    path of file: ./repos/muddle-run/libs/client_lib/src/net
    
    the code of the file until where you have to start completion: use crate::{
    config_storage,
    config_storage::{OfflineAuthConfig, AUTH_CONFIG_KEY},
    net::persistence::PersistenceClient,
    utils::parse_jwt,
};
use bevy::{ecs::system::ResMut, log};
use core::slice::SlicePattern;
use mr_messages_lib::{
    ErrorKind, ErrorResponse, LinkAccount, LinkAccountError, LinkAccountLoginMethod,
    LinkAccountRequest, PatchUserError, PatchUserRequest, RegisterAccountError, RegisteredUser,
};
use reqwest::IntoUrl;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
use url::Url;

const AUTH0_DB_CONNECTION: &str = "Username-Password-Authentication";

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OpenIdConnectConfig {
    pub issuer: Url,
    pub authorization_endpoint: Url,
    pub token_endpoint: Option<Url>,
    pub token_introspection_endpoint: Option<Url>,
    pub userinfo_endpoint: Option<Url>,
    pub end_session_endpoint: Option<Url>,
    pub jwks_uri: Url,
    pub registration_endpoint: Option<Url>,
    #[serde(default)]
    pub scopes_supported: Vec<String>,
    #[serde(default)]
    pub grant_types_supported: Vec<S
    
    async fn sign_in(&mut self, params: &SignInRequestParams) {
        let username = params.username.clone();

        let response = self
            .request::<AuthTokenResponse, SignInErrorResponse, _, _>(
                AUTH0_TOKEN_ENDPOINT,
                RequestParams::UrlEncoded(params),
            )
            .await;

        let Some(response) = response else {
            log::error!("Failed to sign in");
            return;
        };

        match response {
            Ok(response) => {
                if let Err(err) = parse_jwt(&response.id_token) {
                    log::warn!("Failed to parse id_token from the response: {:?}", err);
                    self.send_auth_message(AuthMessage::UnavailableError);
                    return;
                };

                let (success, linked_account) = self.finish_auth(response.id_token.clone()).await;
                if !success || linked_account {
                    return;
                }

                if let Some(refresh_token) = response.refresh_token {
                    if let Err(err) = config_storage::write(
                        AUTH_CONFIG_KEY,
                        &OfflineAuthConfig {
                            username,
                            token_uri: AUTH0_TOKEN_ENDPOINT.to_owned(),
                            id_token: response.id_token,
                            refresh_token,
                        },
                    ) {
                        log::error!("Failed to save auth config: {:?}", err);
                    }
                }
            }
            Err(err) => {
                if err.error == "invalid_grant" {
                    self.send_auth_message(AuthMessage::WrongPasswordError);
                }
            }
        }
    }