How to successfully log out?

Hi everyone we are building an web application and we need to use flask framework with okta, the login is working but when we try to log out using oidc.logout() function and after the redirect we still logged in,I am following this tutorial this is my code.

from flask import Flask,redirect, url_for,g
from flask_bootstrap import Bootstrap
from flask_migrate import Migrate,MigrateCommand 
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager 
from flask_oidc import OpenIDConnect
# local imports
from config import app_config
from okta import UsersClient
import requests
db = SQLAlchemy()

app = Flask(__name__, instance_relative_config=True)

#Obtiene la clave secreta y la cadena de conexion del archivo que se encuenstra en la carpeta instance

app.config["SECRET_KEY"] = "example"
app.config["OIDC_CLIENT_SECRETS"] = "client_secrets.json"
app.config["OIDC_COOKIE_SECURE"] = False
app.config["OIDC_CALLBACK_ROUTE"] = "/oidc/callback"
app.config["OIDC_SCOPES"] = ["openid", "email", "profile"]

app.config["OIDC_ID_TOKEN_COOKIE_NAME"] = "oidc_token"
oidc = OpenIDConnect(app)
okta_client = UsersClient("example", "example")

#Agrega bootstrap a la aplicacion, en este proyecto solo se utiliza wtf de esta libreria, lo demas son archivos

Comandos disponibles para migraciones: python  db init, python  db migrate 
, python  db migrate 
migrate = Migrate(app, db) 

from Project import models

def before_request():
    if oidc.user_loggedin:
        g.user = okta_client.get_user(oidc.user_getfield("sub"))
        g.user = None

def login():
    return redirect(url_for("pagina.home"))
def logout():


    return  redirect(url_for('pagina.home'))