Cannot logout airflow app using Okta

Hello,

I am using Okta for my airflow authentication. I am able to manage to login airflow by using Okta but could not make logout worked.

Following this doc: https://developer.okta.com/docs/reference/api/oidc/?_ga=2.147371892.217170194.1607979248-697717913.1593713664#logout

I get the id token to put in id_token_hint but it shows 404 “page not found” when I clicked logout link on airflow

https://org-name.okta-emea.com/oauth2/aus4oxe6lcrORtml10i7/logout?id_token_hint=eyJraWQiOi…mWtUAavYIbW2SdxAcWttF73Xvha4AlWY6cIxMoOWPa1CKMA&post_logout_redirect_uri=http%3A//airflow-app.dev.example.io/login/

This is logout code:

@expose(’/logout/’, methods=[‘GET’, ‘POST’])
def logout(self):

oidc = self.appbuilder.sm.oid
id_token = oidc.get_access_token()

print("ID TOKEN LOGOUT {} ".format(id_token))

oidc.logout()
super(AuthOIDCView, self).logout()
redirect_url = request.url_root.strip(
    '/') + self.appbuilder.get_url_for_login

issuer_uri = oidc.client_secrets.get('issuer')
logout_uri = f'{issuer_uri}/logout?id_token_hint={id_token}&post_logout_redirect_uri='

if 'OIDC_LOGOUT_URI' in self.appbuilder.app.config:
    logout_uri = self.appbuilder.app.config['OIDC_LOGOUT_URI']

return redirect(logout_uri + quote(redirect_url))

I am not sure what I have done wrong.

Could you please guide me how to fix this issue?

@calvin You may take a look in the console log where the page redirect to. You can check it from browser inspect. Make sure you issuer URL in your code is the same with your auth server.
Also, I attached guides here for your reference:
The OpenID Connect Core specification could be helpful.
Related issue discussion.

@Lijia the issuer URL is the same with my auth server (double checked)
Because I used the custom Authorization server so do I have to set something up on this custom auth server?

the post_logout_redirect_uri=http%3A//airflow-app.dev.example.io/login/ URL is matched with the config I set in App General config logout URI