我正在尝试使用https://fhir.epic.com/的沙箱进行后端服务。
我正在关注本教程:https://fhir.epic.com/Documentation? docId=oauth2§ion=BackendOAuth2Guide :
但我无法将 JWT POST 到端点以获取访问令牌。我应该向此 URL 发送 POST 请求:https://fhir.epic.com/interconnect-fhir-oauth/oauth2/token
。
我正在使用 python,这是到目前为止我的代码:
import json
import requests
from datetime import datetime, timedelta, timezone
from requests.structures import CaseInsensitiveDict
from jwt import (
JWT,
jwk_from_dict,
jwk_from_pem,
)
from jwt.utils import get_int_from_datetime
def main():
instance = JWT()
message = {
# Client ID for non-production
'iss': '990573e-13e3-143b-8b03-4fbb577b660',
'sub': '990573e-13e3-143b-8b03-4fbb577b660',
'aud': 'https://fhir.epic.com/interconnect-fhir-oauth/oauth2/token',
'jti': 'f9eaafba-2e49-11ea-8880-5ce0c5aee679',
'iat': get_int_from_datetime(datetime.now(timezone.utc)),
'exp': get_int_from_datetime(datetime.now(timezone.utc) + …
Run Code Online (Sandbox Code Playgroud)