Skip to content

Instantly share code, notes, and snippets.

@aamishbaloch
Last active October 8, 2019 13:36
Show Gist options
  • Save aamishbaloch/5f2d83e19e6f73e738376fdadb1b8176 to your computer and use it in GitHub Desktop.
Save aamishbaloch/5f2d83e19e6f73e738376fdadb1b8176 to your computer and use it in GitHub Desktop.
import jwt
headers = {
'kid': settings.SOCIAL_AUTH_APPLE_KEY_ID
}
payload = {
'iss': settings.SOCIAL_AUTH_APPLE_TEAM_ID,
'iat': timezone.now(),
'exp': timezone.now() + timedelta(days=180),
'aud': 'https://appleid.apple.com',
'sub': settings.CLIENT_ID,
}
client_secret = jwt.encode(
payload,
settings.SOCIAL_AUTH_APPLE_PRIVATE_KEY,
algorithm='ES256',
headers=headers
).decode("utf-8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment