def init_app(self, app, **kwargs):
        """Flask application initialization.

        :param app: An instance of :class:`flask.Flask`.
        """
        self.init_config(app)

        allowed_urlencode_chars = app.config.get(
            'OAUTH2SERVER_ALLOWED_URLENCODE_CHARACTERS')
        if allowed_urlencode_chars:
            InvenioOAuth2ServerREST.monkeypatch_oauthlib_urlencode_chars(
                allowed_urlencode_chars)
        app.before_request(verify_oauth_token_and_set_current_user)