iOS Firebase Authentication: Sign In With Apple Tutorial | Firebase Bootcamp #5

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ม.ค. 2025

ความคิดเห็น • 68

  • @arnosolo2008
    @arnosolo2008 8 วันที่ผ่านมา

    Oh wow, you make it look so easy. I believe I properly never able to figure out how to implement Sign in with Apple feature with Firebase without watching this video

  • @leneil46
    @leneil46 ปีที่แล้ว +2

    Happy to see you back!!!!!!!🎉

  • @andresraigoza2082
    @andresraigoza2082 ปีที่แล้ว +6

    This is awesome! Thank you so much for taking the time of cleaning up the code, this could be the trickiest part sometimes. I loved the way you implemented the completionHandler in SignInAppleHelper, it made me realize that closures are "Reference Type" in Swift 😮, I've been needing this so many times 😅. You definitely stand out compared with the other Swift TH-cam Channels.

  • @30guarino
    @30guarino ปีที่แล้ว +5

    Holy Sh*t writing code to sign in with Apple was like we were hacking into the U.S Embassy lol....Great job!

    • @SwiftfulThinking
      @SwiftfulThinking  ปีที่แล้ว +1

      Haha yea it really is! I'm expecting Apple will update the API and I'll have to update this video eventually lol

    • @literallyshane4306
      @literallyshane4306 ปีที่แล้ว

      haha!

  • @karaokedeconstruction
    @karaokedeconstruction ปีที่แล้ว

    i miss the intro music but i'm glad you're back with videos

  • @reinaldof
    @reinaldof ปีที่แล้ว +2

    Thanks for sharing your high level knowledge, Nick.

  • @omerfarukozturk9720
    @omerfarukozturk9720 ปีที่แล้ว +1

    This is awesome! Great content

  • @nathandrake6722
    @nathandrake6722 ปีที่แล้ว +2

    You are a lifesaver that's all i'm saying and I haven't watched the video yet

  • @georgekoukouris2347
    @georgekoukouris2347 ปีที่แล้ว

    Thanks a lot for this awesome tutorial! I've been following this playlist for a few videos now and this definitely went over my head at some points. Need to watch the concurrency playlist. Very helpful to see how you deal with problems and your way of debugging errors.

  • @vladimirmoor
    @vladimirmoor ปีที่แล้ว +1

    Fantastic work! Thanks a lot, Nick!

  • @SigmaPC94
    @SigmaPC94 ปีที่แล้ว +2

    Thanks Nick but why it has to be so complex when it comes to the iOS Signin ?

  • @mahoozi.97
    @mahoozi.97 11 หลายเดือนก่อน

    25:31 I asked you regarding displaName on other tutorial, on this function I think should be used OAuthProvider.appleCredential rather than OAuthProvider.credential , but when I changed that I faced this error : Failed: Unable to parse the ID Token.

  • @jehanpoplife
    @jehanpoplife ปีที่แล้ว

    Thanks you so much, you are incredible, that helped me more than you could even think, great great work !

  • @4bh1nav
    @4bh1nav ปีที่แล้ว

    Welcome back!

  • @kavinda_dilshan_paramsoodi
    @kavinda_dilshan_paramsoodi ปีที่แล้ว +1

    Thank you, Nick. Very helpful. I've never implemented Sign in with apple as I still don't have a paid developer account.😍 I will watch this again hopefully this year after getting my developer account.

  • @NickGo
    @NickGo ปีที่แล้ว

    This is amazing. Thank you so much for all the details!

  • @TonyLeung-e5u
    @TonyLeung-e5u 4 หลายเดือนก่อน

    You are legend! Great work👏

  • @도레미파솔-g4r
    @도레미파솔-g4r ปีที่แล้ว +1

    does it matter further lectures if I don't implement appla login here? Well, I wanna pay apple dev account little more later :(

  • @co-park
    @co-park ปีที่แล้ว

    Dude I love you

    • @SwiftfulThinking
      @SwiftfulThinking  ปีที่แล้ว

      ily2

    • @co-park
      @co-park ปีที่แล้ว

      @@SwiftfulThinking btw, think you could do a vid on persisting apple login for Apple+FirebaseAuth combo? I managed to do it, but doesn't feel right

    • @SwiftfulThinking
      @SwiftfulThinking  ปีที่แล้ว

      @@co-park Firebase automatically persists the authentication. If your UI is putting users back to the login screen, then it’s an issue with your UI code and not Firebase 🤔

    • @co-park
      @co-park ปีที่แล้ว

      @@SwiftfulThinking Are you saying I could do something like:
      var body: some View {
      switch Auth.auth().currentUser {
      case nil:
      LoginView()
      default:
      HomeView()
      }
      }
      And it would persist the user regardless of sign in method?
      If so, how long do these sessions persist.

  • @gregas3068
    @gregas3068 ปีที่แล้ว

    Hy. Is there really no simpler way to login with Apple to Firebase? I love your style, but this is really A LOT. So much going on here . . Thank you! And really grateful for the gists!!! Beautiful!

  • @abenstirling
    @abenstirling หลายเดือนก่อน +1

    I had my bundle ID wrong in firebase! Thanks for the content to help me fix it! Live long & swift on 🖖

  • @FFHH-l9b
    @FFHH-l9b 5 หลายเดือนก่อน

    Your email is visible at 52:06

  • @aleixplanasguibas
    @aleixplanasguibas ปีที่แล้ว

    Awesome video! I followed the whole series and it's amazing! I just wanted to know how can I unwrap the name of the user in apple signin? I can't manage to get the name and set it to the DBUser or print it in any way. Any help? Thank you for your work!

  • @tchendoh
    @tchendoh ปีที่แล้ว

    Great content! Everything but the sound is great. You need a better mic/sound setup. :)

    • @SwiftfulThinking
      @SwiftfulThinking  ปีที่แล้ว +2

      Haha yea I actually have a mic but I didn’t realize the fan on my computer was going off when recording, so I tried to edit the sound 😭😭😭 I’ve since bought a new MacBook M2 and it’s super quiet 😎

    • @tchendoh
      @tchendoh ปีที่แล้ว

      @@SwiftfulThinking ahah all right.

  • @ІванФіліпчук-н8э
    @ІванФіліпчук-н8э ปีที่แล้ว

    do you have this code on github?

  • @labudsoft
    @labudsoft 8 หลายเดือนก่อน

    Is there a way of doing this without using an UIKit? It seems to create as much trouble as it solves

    • @SwiftfulThinking
      @SwiftfulThinking  8 หลายเดือนก่อน

      No unfortunately, there’s a SwiftUI way of implementing Apple SSO but it doesn’t work well with Firebase Auth. If they release an easier way, I will 100% replace this video with it

    • @labudsoft
      @labudsoft 8 หลายเดือนก่อน

      @@SwiftfulThinking thank you for the reply, great video

  • @ZirohStory
    @ZirohStory 4 หลายเดือนก่อน

    Can Sign In be this complicated? Thanks to this, I learned a lot about swift. This frustrates me, but I have to make money by making apps. Thank you so much.

  • @konstantin7566
    @konstantin7566 9 หลายเดือนก่อน

    This playlist is very cool. Thank you very much. I ran into a problem, memory leaks, as I understand it. It was worth logging in with Apple, so now the application doesn't even start and xcode writes that it starts consuming too much memory. As I understood it, this is a firebase problem, but the rollback to the old versions did not give any result, alas.

  • @sourPollo
    @sourPollo ปีที่แล้ว

    no source code? :/

  • @milanlabus1582
    @milanlabus1582 8 หลายเดือนก่อน

    Is this code on Github?

  • @magicsaviola
    @magicsaviola ปีที่แล้ว

    Please sign in with facebook

  • @davehall6001
    @davehall6001 8 หลายเดือนก่อน

    great video but.....just too much for me to consume at this moment. Presentation is very confusing and it's gonna take me couple or triple times to watch this video to get it to work!

    • @Spacer-l3j
      @Spacer-l3j 7 หลายเดือนก่อน

      don't bother...There is alternatives for this on TH-cam from Kavasoft. He has Sign in with Apple in a single view

  • @mmendes6780
    @mmendes6780 ปีที่แล้ว

    So handsome

  • @cinquain0
    @cinquain0 ปีที่แล้ว +2

    Dude you are really nuking this. You’re making it way more complex than it needs to be. Your code is so complex it’s dumb

    • @Spacer-l3j
      @Spacer-l3j 7 หลายเดือนก่อน

      Imagine having a senior lead in your team with his mentality. God...his code is so complex and dumb i don't understand why

  • @mjboswell_
    @mjboswell_ 3 หลายเดือนก่อน +1

    Just a heads up: handling Apple's response has changed since the creation of this video (see line of code below). The provider is no longer required, and has been replaced by fullName, which is of type 'PersonNameComponents' 🥴
    let credential = OAuthProvider.appleCredential(withIDToken: idTokenString, rawNonce: nonce, fullName: appleIDCredential.fullName)

  • @jasapvideo4859
    @jasapvideo4859 ปีที่แล้ว

    I ran into a problem when trying to add Sign in With Apple capabilities under signing & capabilities on Xcode. I have also added capability under my app developer profile on the website as well. Have gotten certificates for everything else I needed but am still getting errors for “missing Sign in with Apple” and “missing com.apple.developer.applesignin entitlement.

  • @Kuraudo_VII
    @Kuraudo_VII ปีที่แล้ว +3

    I don't understand why you are making this so complicated by going at such a length to recreate the whole flow that the SwiftUI Apple Sign In Button provides...?
    import SwiftUI
    import AuthenticationServices
    import FirebaseAuth
    struct Logins: View {
    @State var currentNonce = ""
    var body: some View {
    VStack {
    SignInWithAppleButton { request in
    let nonce = randomNonceString() //Use a function to generate nonce
    currentNonce = nonce
    request.requestedScopes = [.email, .fullName]
    request.nonce = sha256(nonce) //Use a function to SHA256 encrypt
    } onCompletion: { result in
    handleAppleSignIn(with: result)
    }
    .frame(height: 40)
    .cornerRadius(8)
    }
    }
    func handleAppleSignIn(with result: Result) {
    switch result {
    case .success(let auth):
    switch auth.credential {
    case let credential as ASAuthorizationAppleIDCredential:
    guard let appleIDToken = credential.identityToken else { return }
    guard let idTokenString = String(data: appleIDToken, encoding: .utf8) else { return }
    // Initialize a Firebase credential, including the user's full name.
    let credential = OAuthProvider.appleCredential(
    withIDToken: idTokenString,
    rawNonce: currentNonce,
    fullName: credential.fullName
    )
    // Sign in with Firebase.
    Auth.auth().signIn(with: credential) { result, error in
    if let error = error {
    print(error.localizedDescription)
    return
    }
    // User is signed in to Firebase with Apple.
    // Continue with your logic
    }
    default:
    print("Error in retrieving auth info")
    }
    case .failure(let error):
    print("Sign in with Apple failed: \(error.localizedDescription)")
    }
    }
    }
    You can also extract currentNonce and the handleAppleSignIn function into a ModelData Object and pass it through as a environmentObject keep things cleaner.

    • @Septix
      @Septix 11 หลายเดือนก่อน +1

      Cannot thank you enough, saved me an hour. Did a few tweaks and its working like charm 15.2

    • @Spacer-l3j
      @Spacer-l3j 7 หลายเดือนก่อน +1

      Brilliant... this is not the only video that he made it very complicated. Sometimes he is very dumb and i don't know why

    • @pigreatlor
      @pigreatlor 6 หลายเดือนก่อน

      is this the entire code you used for the apple sign in model?

    • @Kuraudo_VII
      @Kuraudo_VII 6 หลายเดือนก่อน

      @@pigreatlor pretty much. But that was a while ago. Are you running into any issues?

    • @pigreatlor
      @pigreatlor 6 หลายเดือนก่อน +1

      @@Kuraudo_VII no not yet, ive been looking at the tutorial but at the end i didnt understand all of it. yours seems very short hehe will try it in the next few days. if i run into problems i'll comment here again if you dont mind

  • @PavloMoroz-p9w
    @PavloMoroz-p9w ปีที่แล้ว

    func signInApple() async throws {
    let signInAppleResultsTokens = try await signInAppleHelper.startSignInWithAppleFlow()
    let authDataResult = try await self.authenticationManager.signInWithApple(tokens: signInAppleResultsTokens)
    let user = DatabaseUser(auth: authDataResult)
    try userManager.createNewUser(user: user)
    }
    When we tap to signInApple we create "updating" our DB for currect document. It's wrong?