def begin(self, environ, server_env, start_response, session, key):
        """Step 1: Get a access grant.

        :param environ:
        :param start_response:
        :param server_env:
        :param session:
        """
        try:
            logger.debug("FLOW type: %s", self.flow_type)
            logger.debug("begin environ: %s", server_env)
            client = session['client']
            if client is not None and self.srv_discovery_url:
                data = {"client_id": client.client_id}
                resp = requests.get(self.srv_discovery_url + "verifyClientId",
                                    params=data, verify=False)
                if not resp.ok and resp.status_code == 400:
                    client = None
                    server_env["OIC_CLIENT"].pop(key, None)

            _state = ""
            if client is None:
                callback = server_env["base_url"] + key
                logout_callback = server_env["base_url"]
                if self.srv_discovery_url:
                    client = self.dynamic(server_env, callback, logout_callback,
                                          session, key)
                else:
                    client = self.static(server_env, callback, logout_callback,
                                         key)
                _state = session['state']
                session['client'] = client

            acr_value = session.get_acr_value(client.authorization_endpoint)
            try:
                acr_values = client.provider_info["acr_values_supported"]
                session['acr_values'] = acr_values
            except KeyError:
                acr_values = None

            if acr_value is None and acr_values is not None and \
                            len(acr_values) > 1:
                resp_headers = [("Location", str("/rpAcr"))]
                start_response("302 Found", resp_headers)
                return []
            elif acr_values is not None and len(acr_values) == 1:
                acr_value = acr_values[0]
            return self.create_authnrequest(environ, server_env, start_response,
                                            session, acr_value, _state)
        except Exception:
            message = traceback.format_exception(*sys.exc_info())
            logger.error(message)
            return self.result(
                environ, start_response, server_env,
                (False, "Cannot find the OP! Please view your configuration."))

    # noinspection PyUnusedLocal
dataset/ETHPy150Open rohe/pyoidc/oidc_example/rp2/oidc.py/OpenIDConnect.begin/original