diff --git a/authentik/stages/authenticator_mobile/api/device.py b/authentik/stages/authenticator_mobile/api/device.py index 70fab32f1..b5b088196 100644 --- a/authentik/stages/authenticator_mobile/api/device.py +++ b/authentik/stages/authenticator_mobile/api/device.py @@ -53,19 +53,19 @@ class MobileDeviceCheckInSerializer(PassiveSerializer): info = MobileDeviceInfoSerializer() -class MobileDeviceEnrollmentSerializer(PassiveSerializer): - """Enrollment request, send the device's unique identifier""" - - device_uid = CharField(required=True) - info = MobileDeviceInfoSerializer() - - class MobileDeviceSetPushKeySerializer(PassiveSerializer): """Set notification key""" firebase_key = CharField(required=True) +class MobileDeviceEnrollmentSerializer(MobileDeviceSetPushKeySerializer): + """Enrollment request, send the device's unique identifier""" + + device_uid = CharField(required=True) + info = MobileDeviceInfoSerializer() + + class MobileDeviceResponseSerializer(PassiveSerializer): """Response from push sent to phone""" @@ -120,6 +120,7 @@ class MobileDeviceViewSet( device.name = data.validated_data["info"]["hostname"] device.confirmed = True device.device_id = data.validated_data["device_uid"] + device.firebase_token = data.validated_data["firebase_key"] device.save() MobileDeviceToken.objects.filter( device=device, diff --git a/schema.yml b/schema.yml index dc4247099..2d53bd303 100644 --- a/schema.yml +++ b/schema.yml @@ -35380,6 +35380,9 @@ components: type: object description: Enrollment request, send the device's unique identifier properties: + firebase_key: + type: string + minLength: 1 device_uid: type: string minLength: 1 @@ -35387,6 +35390,7 @@ components: $ref: '#/components/schemas/MobileDeviceInfoRequest' required: - device_uid + - firebase_key - info MobileDeviceEnrollmentStatus: type: object diff --git a/schemas/authentik-cloud-gateway.yml b/schemas/authentik-cloud-gateway.yml index ccb8ec915..89484de1f 100644 --- a/schemas/authentik-cloud-gateway.yml +++ b/schemas/authentik-cloud-gateway.yml @@ -511,6 +511,9 @@ components: type: object description: Enrollment request, send the device's unique identifier properties: + firebase_key: + type: string + minLength: 1 device_uid: type: string minLength: 1 @@ -518,6 +521,7 @@ components: $ref: '#/components/schemas/MobileDeviceInfoRequest' required: - device_uid + - firebase_key - info MobileDeviceEnrollmentStatus: type: object