为什么在宣誓时使用重定向?

Why is a redirect used on oath?

请参阅此处的示例。为什么重定向仅用于连接到服务?为什么要为模拟服务和所有这些东西而烦恼呢?所有这一切是否有正当理由,或者仅仅是因为有人对如何使用身份验证做出了假设(即作者和用户不同)?在 REPL 中有避免这种情况的好方法吗?

https://github.com/SaxoBank/openapi-samples-python/blob/master/authentication/oauth/code-flow/bare-bones-code-flow-app.py

我不完全理解你的问题,但是关于 SAXO APIoauth 令牌,你总是需要定义 RedirectUrls 来生成令牌。这就是为什么所提供的 5 个键确实是强制性的:

params = {
    "grant_type": "refresh_token",
    "refresh_token": token_data["refresh_token"],
    "redirect_uri": app_config["RedirectUrls"][0],
    "client_id": app_config["AppKey"],
    "client_secret": app_config["AppSecret"] 
}

仅供参考,您可以在下面找到 Redirect URI 的完整文档:

https://www.oauth.com/oauth2-servers/redirect-uris/