Migrating Sign in with Apple from WebView to Swift

Our app currently uses login with Apple ID inside a webview and due to some AppStore updates, we are now required to use the native Swift implementation.

We generate tokens in the web version according to this documentation https://developer.apple.com/documentation/sign_in_with_apple/generate_and_validate_tokens, passing the client_id and response_type as code id_token in the request because the code and id_token in the response are used on our backend to complete the user's registration procedure (along with the optional name/email).

However, when following the guide https://developer.apple.com/documentation/sign_in_with_apple/implementing_user_authentication_with_sign_in_with_apple, we only have the userIdentifier, fullName and email as a response after logging in with Apple. The login works on Apple side but we don't have the necessary info we need.

Is there any Swift method or API from Apple's side that would allow me to retrieve a code and id_token (JWT) in conjunction with the userIdentifier? Or should the login procedure be a totally different flow from backend's perspective?