try conenct to api iota for validation

This commit is contained in:
Cayo Puigdefabregas 2023-12-08 20:54:44 +01:00
parent 950cc59cae
commit 543aad813d
1 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import json import json
import logging import logging
import base64
import requests import requests
from authlib.integrations.flask_oauth2 import current_token from authlib.integrations.flask_oauth2 import current_token
@ -221,8 +222,19 @@ class AllowCodeOidc4vpView(GenericMixin):
discovery = {} discovery = {}
def dispatch_request(self): def dispatch_request(self):
self.code = request.args.get('code') self.vp_token = request.values.get("vp_token")
self.oidc = session.get('oidc') # 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"}) return jsonify({"result": "ok"})
# if not self.code or not self.oidc: # if not self.code or not self.oidc:
# return self.redirect() # return self.redirect()