Reputation: 430
I am trying to integrate autofill for a verification code in one of my iOS projects. I have added an apple-app-site-association file to my domain. It was integrated successfully, as now the iOS keyboard auto-suggests passwords saved in my SwiftUI app with the saved username and password.
Additionally, my app implements two-factor authentication (OTP), which users can enable. This feature uses a QR code that can be shared. When the QR code OTP is shared, it automatically opens the iOS cloud keychain and associates the verification codes with the domain. From the iOS password settings, I can see that the verification code is being generated, and the auto-suggestion shows the OTP code and autofills, but only in my current website opened through Safari. However, it does not show up in my SwiftUI iOS app.
Integrated for the website :
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
</div>
<div class="form-group">
<label for="otp">OTP:</label>
<input id="single-factor-code-text-field" autocomplete="one-time-code"/>
</div>
<div class="form-group">
<button type="submit">Submit</button>
</div>
and for the app:
TextField("", text: $otpText.limit(6))
.keyboardType(.numberPad)
.textContentType(.oneTimeCode)
I hope this helps clarify the issue. Any advice or suggestions would be greatly appreciated. As for the device, I am using Iphone Xs with ios version 17.5.1.
Upvotes: 0
Views: 104