Skip to content

Commit

Permalink
feat: 카카오 로그인 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
heejinnn committed Dec 8, 2023
1 parent fdde306 commit 27f405f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 34 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file not shown.
8 changes: 2 additions & 6 deletions fit-a-pet-client/fit-a-pet-client/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import UIKit
import KakaoSDKCommon
import GoogleSignIn


@main
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -18,11 +18,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

return true
}


func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
return GIDSignIn.sharedInstance.handle(url)
}


// MARK: UISceneSession Lifecycle

Expand Down
29 changes: 1 addition & 28 deletions fit-a-pet-client/fit-a-pet-client/ViewControllers/FirstVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import UIKit
import SnapKit
import KakaoSDKAuth
import KakaoSDKUser
import GoogleSignIn

import Alamofire

class FirstVC: UIViewController {
Expand Down Expand Up @@ -107,7 +107,6 @@ extension FirstVC{


kakaoLogin.addTarget(self, action: #selector(kakaoLoginBtnTapped(_:)), for: .touchUpInside)
googleLogin.addTarget(self, action: #selector(googleLoginBtnTapped(_ :)), for: .touchUpInside)

let loginButtons = [naverLogin, kakaoLogin, googleLogin, appleLogin]

Expand Down Expand Up @@ -174,32 +173,6 @@ extension FirstVC{
}
}
}
@objc func googleLoginBtnTapped(_ sender: UIButton){
GIDSignIn.sharedInstance.signIn(
withPresenting: self) { signInResult, error in
guard error == nil else { return }
guard let signInResult = signInResult else { return }

let user = signInResult.user
let emailAddress = user.profile?.email
let fullName = user.profile?.name
let profilePicUrl = user.profile?.imageURL(withDimension: 320)

print("user: \(user)")
print("emailAddress: \(String(describing: emailAddress))")
print("fullName: \(String(describing: fullName))")
print("profileUrl: \(String(describing: profilePicUrl))")

signInResult.user.refreshTokensIfNeeded { user, error in
guard error == nil else { return }
guard let user = user else { return }

let idToken = user.idToken

print("idToken: \(String(describing: idToken))")
}
}
}

@objc func changeSignUpVC(_ sender: UIButton){
let nextVC = InputPhoneNumVC()
Expand Down

0 comments on commit 27f405f

Please sign in to comment.