@auth_blueprint.route('/oauth2/client')
def client():
    if not current_user.is_authenticated:
        return api.abort(code=http_exceptions.Unauthorized.code)
    # XXX: remove hard-codings
    # TODO: reconsider using gen_salt
    # TODO: develop sensible scopes
    # TODO: consider moving `db` operations into OAuth2Client class implementation
    client_instance = OAuth2Client(
        client_id=security.gen_salt(40),
        client_secret=security.gen_salt(50),
        _redirect_uris=' '.join([
            'http://localhost:8000/authorized',
            'http://127.0.0.1:8000/authorized',
            'http://127.0.0.1:5000/api/v1/o2c.html',
            'http://127.0.0.2:8000/authorized',
            'http://127.0.1:8000/authorized',
            'http://127.1:8000/authorized',
            ]),
        _default_scopes='users:read users:write email',
        user_id=current_user.id,
    )
    db.session.add(client_instance)
    db.session.commit()
    return jsonify(
        client_id=client_instance.client_id,
        client_secret=client_instance.client_secret,
    )
This endpoint creates and provides the authenticated user with
dataset/ETHPy150Open frol/flask-restplus-server-example/app/modules/auth/views.py/client