OpenID Connect - redirect_uri http vs https


I have successfully deployed a simple python flask app that uses Flask-OIDC to authenticate to our orgs okta server. Everything works perfectly when the redirect_uri is http like this:

If I try and switch it to https like this:

it does not work and I get a 400 response:

Description: The ‘redirect_uri’ parameter must be a Login redirect URI in the client app settings: https://[ommitted]

I have https in my client_secrets.json and also in my application config in my orgs okta server. I noticed this is the url that is sent to my orgs okta server from my client:

I noticed “http%3A%2F%2Fstizzle2”. Shouldnt it be sending “https%3A%2F%2Fstizzle2”?

Any ideas on why it works via http, but doesnt work via https?

How is the /authorize call being generated? Is this with one of our libraries or do you generate the call in your code?

There is a parameter access_type that I am not familiar with. I believe Google may use this for an auth code flow? The value is set to ‘offline’ which I believe means you want to include a refresh token? If that is the case the access_type parameter should be removed and in the scope parameter add ‘offline_access’ to the existing scopes.

For passing ‘http’ instead of ‘https’ that depends on how the /authorize call is made. If it was with one of our libraries it would be a config issue, but I am not familiar with our libraries passing access_type. So I am assuming the /authorize call is being generated by some other means.

I am using the auth code flow. I’m using the Flask-OIDC package in my python Flask app. It takes care of the heavy lifting. My code is as simple as this:

from flask_oidc import OpenIDConnect

app = Flask(name)

‘SECRET_KEY’: ‘SomethingNotEntirelySecret’,
‘OIDC_CLIENT_SECRETS’: ‘./client_secrets.json’,
‘OIDC_SCOPES’: [“openid”, “profile”, “email”],
‘OIDC_CALLBACK_ROUTE’: ‘/authorization-code/callback’,

oidc = OpenIDConnect(app)

def home():
return render_template(“home.html”, oidc=oidc)

def login():
return redirect(url_for(“profile”))

def profile():
info = oidc.user_getinfo([“sub”, “name”, “email”])
return render_template(“profile.html”, profile=info, oidc=oidc)

None of what I am doing requires a refresh token. Again, everything works fine as long as I’m using http when defining my redirect_uri. It fails when I try to use https.

As far as how to get Flask-OIDC to send https I am not sure, I have not worked with it.

Looking at the app.config I do not see where you supply a full callback, only relative.

My guess would be that Flask-OIDC would generate the full redirect uri based off of how your application is being accessed. If you access it with http, it will use http, if you access https, it will use https.

Just a guess.