使用 pyJWT 和 Python 解码 Apple 的 id_token(登录)
Decode Apple's id_token (Signin) using pyJWT and Python
如何在 Python 中解码 Apple 在注册过程中发送的 id_token?
我试过了(从这里)
import jwt
decoded = jwt.decode(token, options={"verify_signature": False})
我收到一个错误:
jwt.exceptions.InvalidAudienceError: Invalid audience
如果我 copy-paste id_token 进入 jwt.io 页面 https://jwt.io/ 然后它正确地将它解码成它的所有部分(header,带有音频的有效负载, sub, 等等)所以令牌本身是正确的,我有我需要的所有信息。
当我提供预期的 aud 值时,它会起作用。 aud 与您第一次调用Apple登录时提供的clientId相同(https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/configuring_your_webpage_for_sign_in_with_apple),与您设置它的Apple控制台中的Identifier相同。
必须有一种方法可以在不提供音频的情况下执行此操作,因为这个 wbeage https://jwt.io/ 可以做到。但是,也许不在 Python...
import jwt
decoded = jwt.decode(token, audience="<your app's>",options={"verify_signature": False})
如何在 Python 中解码 Apple 在注册过程中发送的 id_token?
我试过了(从这里
import jwt
decoded = jwt.decode(token, options={"verify_signature": False})
我收到一个错误:
jwt.exceptions.InvalidAudienceError: Invalid audience
如果我 copy-paste id_token 进入 jwt.io 页面 https://jwt.io/ 然后它正确地将它解码成它的所有部分(header,带有音频的有效负载, sub, 等等)所以令牌本身是正确的,我有我需要的所有信息。
当我提供预期的 aud 值时,它会起作用。 aud 与您第一次调用Apple登录时提供的clientId相同(https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/configuring_your_webpage_for_sign_in_with_apple),与您设置它的Apple控制台中的Identifier相同。
必须有一种方法可以在不提供音频的情况下执行此操作,因为这个 wbeage https://jwt.io/ 可以做到。但是,也许不在 Python...
import jwt
decoded = jwt.decode(token, audience="<your app's>",options={"verify_signature": False})