diff --git a/powerdnsadmin/routes/api.py b/powerdnsadmin/routes/api.py index 738c933..e33c946 100644 --- a/powerdnsadmin/routes/api.py +++ b/powerdnsadmin/routes/api.py @@ -1,5 +1,6 @@ import json from urllib.parse import urljoin +from base64 import b64encode from flask import ( Blueprint, g, request, abort, current_app, make_response, jsonify, ) @@ -357,6 +358,7 @@ def api_generate_apikey(): current_app.logger.error('Error: {0}'.format(e)) raise ApiKeyCreateFail(message='Api key create failed') + apikey.plain_key = b64encode(apikey.plain_key.encode('utf-8')).decode('utf-8') return jsonify(apikey_plain_schema.dump([apikey])[0]), 201