From 543aad813de0b61595ac0660fd7bddf4e0f68075 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 8 Dec 2023 20:54:44 +0100 Subject: [PATCH] try conenct to api iota for validation --- ereuse_devicehub/modules/oidc/views.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/modules/oidc/views.py b/ereuse_devicehub/modules/oidc/views.py index cdb7a036..9e21d837 100644 --- a/ereuse_devicehub/modules/oidc/views.py +++ b/ereuse_devicehub/modules/oidc/views.py @@ -1,5 +1,6 @@ import json import logging +import base64 import requests from authlib.integrations.flask_oauth2 import current_token @@ -221,8 +222,19 @@ class AllowCodeOidc4vpView(GenericMixin): discovery = {} def dispatch_request(self): - self.code = request.args.get('code') - self.oidc = session.get('oidc') + self.vp_token = request.values.get("vp_token") + # pv= self.vp_token.split(".") + # token = json.loads(base64.b64decode(pv[1]).decode()) + headers = { + 'Content-Type': 'application/json', + 'Authorization': f'Bearer WALLET_INX_EBSI_PLUGIN_TOKEN' + } + data = json.dumps({ + "type": "VerificationRequest", + "jwtCredential": self.vp_token + }) + result = requests.post(WALLET_INX_EBSI_PLUGIN_URL, headers=headers, json=data) + return jsonify({"result": "ok"}) # if not self.code or not self.oidc: # return self.redirect()