def callback(self, response, session, format='dict'):
        """
        This is the method that should be called when an AuthN response has been
        received from the OP.

        :param response: The URL returned by the OP
        :return:
        """
        try:
            authresp = self.parse_response(AuthorizationResponse, response,
                                           sformat=format, keyjar=self.keyjar)
        except ResponseError:
            logger.error("Could not parse response: '{}'".format(response))
            raise OIDCError("Problem parsing response")

        logger.info("AuthorizationReponse: {}".format(authresp))
        if isinstance(authresp, ErrorResponse):
            if authresp["error"] == "login_required":
                return self.create_authn_request(session)
            else:
                raise OIDCError("Access denied")

        if session["state"] != authresp["state"]:
            self._err("Received state not the same as expected.")

        try:
            _id_token = authresp['id_token']
        except KeyError:
            _id_token = None
        else:
            if _id_token['nonce'] != session["nonce"]:
                self._err("Received nonce not the same as expected.")

        if self.behaviour["response_type"] == "code":
            # get the access token
            try:
                args = {
                    "code": authresp["code"],
                    "redirect_uri": self.registration_response[
                        "redirect_uris"][0],
                    "client_id": self.client_id,
                    "client_secret": self.client_secret,
                }

                try:
                    args['scope'] = response['scope']
                except KeyError:
                    pass

                atresp = self.do_access_token_request(
                    state=authresp["state"],
                    request_args=args,
                    authn_method=self.registration_response[
                        "token_endpoint_auth_method"])
                logger.info('Access token response: {}'.format(atresp))
            except Exception as err:
                logger.error("%s" % err)
                raise

            if isinstance(atresp, ErrorResponse):
                self._err('Error response: {}'.format(atresp.to_dict()))

            _token = atresp['access_token']

            try:
                _id_token = atresp['id_token']
            except KeyError:
                pass
        else:
            _token = authresp['access_token']

        if not self.oidc:
            return {'access_token': _token}

        if _id_token is None:
            self._err("Invalid response: no IdToken")

        if _id_token['iss'] != self.provider_info['issuer']:
            self._err("Issuer mismatch")

        if _id_token['nonce'] != session['nonce']:
            self._err("Nonce mismatch")

        if not self.allow_sign_alg_none:
            if _id_token.jws_header['alg'] == 'none':
                self._err('Do not allow "none" signature algorithm')

        user_id = '{}:{}'.format(_id_token['iss'], _id_token['sub'])

        if self.get_userinfo:
            if self.userinfo_request_method:
                kwargs = {"method": self.userinfo_request_method}
            else:
                kwargs = {}

            if self.has_access_token(state=authresp["state"]):
                inforesp = self.do_user_info_request(state=authresp["state"],
                                                     **kwargs)

                if isinstance(inforesp, ErrorResponse):
                    self._err(inforesp["error"] % "Invalid response %s.")

                userinfo = inforesp.to_dict()

                if _id_token['sub'] != userinfo['sub']:
                    self._err("Invalid response: userid mismatch")

                logger.debug("UserInfo: %s" % inforesp)

                try:
                    self.id_token[user_id] = _id_token
                except TypeError:
                    self.id_token = {user_id: _id_token}
            else:
                userinfo = {}
                for attr in OpenIDSchema.c_param:
                    try:
                        userinfo[attr] = _id_token[attr]
                    except KeyError:
                        pass

            return {'user_id': user_id, 'userinfo': userinfo,
                    'id_token': _id_token, 'access_token': _token}
        else:
            return {'user_id': user_id, 'id_token': _id_token,
                    'access_token': _token}
dataset/ETHPy150Open rohe/pyoidc/src/oic/utils/rp/__init__.py/Client.callback/swapped operands of `%`