fix url for get userinfo

This commit is contained in:
Cayo Puigdefabregas 2023-12-21 11:51:03 +01:00
parent 5d58e1e55e
commit 0a89b3f1be
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import json import json
import requests import requests
from django.apps import apps from django.apps import apps
from django.conf import settings
from django.http import Http404, JsonResponse from django.http import Http404, JsonResponse
from django.contrib.admin.utils import unquote from django.contrib.admin.utils import unquote
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
@ -26,7 +27,9 @@ def serve_private_media(request, app_label, model_name, field_name, object_id, f
def get_user_info(token): def get_user_info(token):
url = "http://localhost:5000/oauth/userinfo" # domain = settings.OIDC_PROVIDER.strip("/")
domain = "https://idp.demo.pangea.org"
url = f"{domain}/application/o/userinfo/"
access_token = token['access_token'] access_token = token['access_token']
token_type = token.get('token_type', 'Bearer') token_type = token.get('token_type', 'Bearer')
headers = {"Authorization": f"{token_type} {access_token}"} headers = {"Authorization": f"{token_type} {access_token}"}