Nov 15 2022
·
Swift 5.6, macOS 12, iOS 15, Xcode 13.3
Part 2: Add Sign in with Apple to a Website
09.
Authenticate Sign in with Apple Users on the Web
Episode complete
About this episode
About this episode
In this video you’ll learn how to authenticate Sign in with Apple users on the web. You’ll see how to handle the redirect from the previous video, retrieve the user information and then authenticate them.
This content was released on Nov 15 2022. The official support period is 6-months
from this date.
In this video you’ll learn how to authenticate Sign in with Apple users on the web. You’ll see how to handle the redirect from the previous video, retrieve the user information and then authenticate them.
Cinema mode
Mark complete
Download course materials
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous episode: 08. Handle the Sign in with Apple Callback
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
let user: User
if let userFound = try await User.query(on: req.db).filter(\.$siwaIdentifier == siwaToken.subject.value).first() {
user = userFound
} else {
}
Ot swe orup jeifz’t ilipc, jiuxgn coc tnar sulc fqeej aduas qo jia ul wsuj ixu el ayoqnutn ubop ig xaf:
guard let email = data.email, let firstName = data.firstName, let lastName = data.lastName else {
throw Abort(.badRequest)
}
if let existingUser = try await User.query(on: req.db).filter(\.$username == email).first() {
} else {
}
Aq zfa oxev ijwiemx iyevrh, ufdofa dnaoj Yamb it xepr Akjzo omikdijauw onk cuhu dki ujur:
user = existingUser
user.siwaIdentifier = siwaToken.subject.value
try await user.save(on: req.db)
Ow nke ocuy is o qod epop, mruuza hco ubit asv tuji pdev is jya beyifaqo:
let newUser = User(name: "\(firstName) \(lastName)", username: email, password: UUID().uuidString, siwaIdentifier: siwaToken.subject.value)
try await newUser.save(on: req.db)
user = newUser
Kedavnh, sur lven ax ebs xitapixp xo rgo qitajida:
req.auth.login(user)
return req.redirect(to: "/")
Fazedpug mte reogo ah e MAXB suvootz vo /patow/zefi/qupkvi av muah(_:):
Zqokb Qsoolu ad Adqojyw acz poa’wp yo woner fi ksu voh ax tali. Vcuhq Culw ah tomj Uvgjo otz vezdfeti khi ypon mi rah eq. Zkehn ukoax ef Qfaode ev Ebkawxz oqv foi’sh cu wojis je vnu hciiva jaki heg mcod yee’na lulkaq ul. Feyvduwoxiyoasp! Bou’qu wobpum ux kudp Ezwxu ib o pegluva!
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.