async def METHOD_NAME(self, plugin_ctx: PluginCtx):
    curr_user_id = plugin_ctx.session.get('user', {'id': None})['id']
    api_key = self._get_api_key(plugin_ctx)
    if api_key:
        hash_key = hashlib.sha256(api_key.encode()).hexdigest()
        user_info = await self._find_user(hash_key)
        if self.is_anonymous(curr_user_id):
            plugin_ctx.session.clear()
        if user_info is None:
            plugin_ctx.session['user'] = self.anonymous_user(plugin_ctx)
        else:
            plugin_ctx.session['user'] = user_info
    else:
        if not self.is_anonymous(curr_user_id):
            plugin_ctx.session.clear()
        plugin_ctx.session['user'] = self.anonymous_user(plugin_ctx)