diff --git a/hiboo/sso/oidc.py b/hiboo/sso/oidc.py
index 3d603a6de80f1f5f7c2bd7ee7928646573d74935..7019dce1a0fb5082fb937bdabd50a61818ab977c 100644
--- a/hiboo/sso/oidc.py
+++ b/hiboo/sso/oidc.py
@@ -103,14 +103,17 @@ class OpenIDMixin(object):
     def exists_nonce(self, nonce, request):
         return bool(utils.redis.get("nonce:{}".format(nonce)))
 
+    def get_client(self):
+        # TODO: this is a terribly ugly hack meant only as a temporary measure
+        # waiting for authlib to merge our PRs allowing a more generic way of
+        # always having the current client in the context.
+        return inspect.currentframe().f_back.f_back.f_back.f_locals["self"].client
+
     def get_jwt_config(self, grant=None):
-        # In the case of AuthorizationCode, the current object is not the grant
-        # but a grant extension, so the client is retrieved through the grant argument
-        client = self.request.client if grant is None else grant.client
-        return client.get_jwt_config()
+        return self.get_client().get_jwt_config()
 
     def generate_user_info(self, user, scope):
-        return Client.generate_user_info(user, scope)
+        return self.get_client().generate_user_info(user, scope)
 
 
 class Client(sqla_oauth2.OAuth2ClientMixin):
@@ -157,8 +160,7 @@ class Client(sqla_oauth2.OAuth2ClientMixin):
             'exp': 3600,
         }
 
-    @classmethod
-    def generate_user_info(cls, user, scope):
+    def generate_user_info(self, user, scope):
         """ User info generation function used by the oidc code mixin and the userinfo endpoint
         """
         return oidc.UserInfo(