|
@@ -3342,12 +3342,13 @@ class AppleAuthLogin(View):
|
|
|
|
|
|
response = ResponseObject(lang)
|
|
response = ResponseObject(lang)
|
|
identity_token = CommonService.decode_data(identity_token)
|
|
identity_token = CommonService.decode_data(identity_token)
|
|
|
|
+ # print(identity_token)
|
|
if identity_token:
|
|
if identity_token:
|
|
key_url = 'https://appleid.apple.com/auth/keys'
|
|
key_url = 'https://appleid.apple.com/auth/keys'
|
|
key_response = requests.get(key_url).json()
|
|
key_response = requests.get(key_url).json()
|
|
- print(key_response)
|
|
|
|
|
|
+ # print(key_response)
|
|
head = jwt.get_unverified_header(identity_token)
|
|
head = jwt.get_unverified_header(identity_token)
|
|
- print(head)
|
|
|
|
|
|
+ # print(head)
|
|
token_key = head['kid']
|
|
token_key = head['kid']
|
|
key_object = None
|
|
key_object = None
|
|
alg = None
|
|
alg = None
|
|
@@ -3373,7 +3374,10 @@ class AppleAuthLogin(View):
|
|
else:
|
|
else:
|
|
# 如果用户为绑定过则创建用户并进行登录返回token
|
|
# 如果用户为绑定过则创建用户并进行登录返回token
|
|
userID = CommonService.getUserID(getUser=False)
|
|
userID = CommonService.getUserID(getUser=False)
|
|
- nickname = claims['email']
|
|
|
|
|
|
+ if claims.__contains__('email'):
|
|
|
|
+ nickname = claims['email']
|
|
|
|
+ else:
|
|
|
|
+ nickname = 'apple_{num}'.format(num=CommonService.RandomStr(6, False))
|
|
return self.do_register(userID, nickname, response, app_bundle_id, unionID)
|
|
return self.do_register(userID, nickname, response, app_bundle_id, unionID)
|
|
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|