Python - error from Flask example (was working)

Back in November 2018 I started playing with the Flask example from and it worked OK.
I just dusted it off again to have another look and it’s not working -

def before_request():
    Load a proper user object using the user ID from the ID token. This way, the
    `g.user` object can be used at any point.
    if oidc.user_loggedin:
        g.user = okta_client.get_user(oidc.user_getfield("sub"))  <<< this is throwing an exception
        g.user = okta_client.get_user(None)

Exception: okta.framework.OktaError.OktaError: Invalid token provided

Any ideas?