๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿค2024 ์•ˆ๋“œ๋กœ์ด๋“œ/๐Ÿฟ ์˜ํ™” ํ”„๋กœ์ ํŠธ ๊ฐœ๋ฐœ ์ผ์ง€

android์—์„œ ๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ ์—ฐ๋™ํ•˜๊ธฐ

by hyeonha 2024. 2. 3.

๋ชฉ์ฐจ

    ๐Ÿ˜Š ๋“ค์–ด๊ฐ€๊ธฐ ์ „์—

    ์•ˆ๋“œ๋กœ์ด๋“œ ์•ฑ์— ๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๋ ค๊ณ  ๊ณต์‹๋ฌธ์„œ๋ถ€ํ„ฐ ๋งŽ์ด ๋ฌธ์„œ๋ฅผ ์ฐพ์•„๋ณด์•˜์ง€๋งŒ ๋”์ด์ƒ ์ง€์›๋˜์ง€ ์•Š๋Š” ๋ฐฉ์‹์ธ ์›ํƒญ์— ๋Œ€ํ•œ ๊ธ€์ด ๋Œ€๋ถ€๋ถ„์ด์—ˆ๋‹ค. 

    ์ง€์›๋˜์ง€ ์•Š๋Š”๋‹ค๋Š” ๋ง์„ ๋ณด๊ณ  ์ž‘๋™ํ•˜์ง€ ์•Š์„ ๊ฒƒ์ด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ๊ณ , ์–ด๋–ป๊ฒŒ ๊ตฌํ˜„ํ•ด์•ผํ• ์ง€ ๋ง‰๋ง‰ํ•˜๋˜ ์ฐธ์—
    ๊ธฐ๋Šฅ์ด ์ž˜ ์ž‘๋™๋˜์–ด์„œ ์šฐ์„  ๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ ๊ตฌํ˜„์„ ์œ„ํ•œ ์ˆœ์„œ๋ฅผ ์ •๋ฆฌํ•ด๋ณด์•˜๋‹ค! ์ดํ›„ ์ธ์ฆ ๊ด€๋ฆฌ์ž๋กœ ์ฝ”๋“œ๋ฅผ ๋ฐ”๊พธ๋ฉฐ ๋ฆฌํŽ™ํ† ๋ง์„ ํ•  ์˜ˆ์ •์ด๋‹ค.

    ์•„๋ž˜์ฒ˜๋Ÿผ ์›ํƒญ ๋กœ๊ทธ์ธ์„ ๊ตฌํ˜„ํ•ด๋ณด์ž~~

     


    1๏ธโƒฃ ์›ํƒญ ๋กœ๊ทธ์ธ ํด๋ผ์ด์–ธํŠธ ๊ตฌ์„ฑํ•˜๊ธฐ

    ์šฐ๋ฆฌ ์•ฑ์—์„œ๋Š” Google ๋กœ๊ทธ์ธ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ setGoogleIdTokenRequestOptions ( )์„ ์‚ฌ์šฉํ•˜์—ฌ Google ID ํ† ํฐ ์š”์ฒญ์„ ์‚ฌ์šฉ ์„ค์ •ํ•˜๊ณ  ๊ตฌ์„ฑํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

           //์›ํƒญ ๋กœ๊ทธ์ธ ํด๋ผ์ด์–ธํŠธ ๊ตฌ์„ฑ
            oneTapClient = Identity.getSignInClient(this)
            
            signInRequest = BeginSignInRequest.builder()
                .setGoogleIdTokenRequestOptions(
                    BeginSignInRequest.GoogleIdTokenRequestOptions.builder()
                        .setSupported(true)
                        .setServerClientId(SERVER_CLIENT_ID)
                        .setFilterByAuthorizedAccounts(false)
                        .build()
                )
                .build()

     

    - SignInClient๋Š” ๋กœ๊ทธ์ธ api๋ฅผ ์œ„ํ•œ client์ด๋‹ค.

    SignInClient๋Š” sign-in (๋กœ๊ทธ์ธ) ๊ณผ sign-up (๋“ฑ๋ก) ๋‘ ์‹œ๋‚˜๋ฆฌ์˜ค์—์„œ ๊ฐ™์€ ํ๋ฆ„์„ ๊ณต์œ ํ•˜์ง€๋งŒ  BeginSignInRequest ์—์„œ๋Š” ๋‹ค๋ฅธ ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ์ œ๊ณตํ•ด์•ผ๋งŒ ํ•œ๋‹ค.

     

    ๐Ÿ”ฅ PasswordRequestOptions ๋กœ ๊ตฌํ˜„ ์‹œ ์›ํƒญ ๋กœ๊ทธ์ธ UI์™€ ๋™์ž‘์ด ์–ด๋–ป๊ฒŒ ๋‹ค๋ฅธ์ง€ ๋น„๊ตํ•ด๋ณด๊ธฐ 

     

    credential์— ๋Œ€ํ•œ ์„ค๋ช…

    ๋”๋ณด๊ธฐ

    ์šฐ์„  credential ์ด๋ผ๋Š” ๊ฐœ๋…์„ ์•Œ๊ณ  ์•„๋ž˜์˜ ์„ค๋ช…์„ ๋ณด์ž
    credential์€ ์ž๊ฒฉ์ด ์žˆ๋Š”์ง€ ์ฆ๋ช…ํ•˜๊ธฐ ์œ„ํ•œ ์ˆ˜๋‹จ์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ๋œ๋‹ค. 

     

    ๋กœ๊ทธ์ธ(sign-in), ๋“ฑ๋ก(sign-up)์—์„œ ๋‹ค๋ฅธ BeginSignInRequest๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

     

    - ์กด์žฌํ•˜๋Š” ์‚ฌ์šฉ์ž๋Š” ๋กœ๊ทธ์ธํ•œ๋‹ค.

    ๋‘ ์ข…๋ฅ˜์˜ credentials์€ SignInCredential ์—์„œ ์ง€์›ํ•œ๋‹ค.

     

    - credential์˜ ์ข…๋ฅ˜

    1. Google Id token credential

    2. Password credential

     

    ์‚ฌ์šฉ์ž์—๊ฒŒ ์„ ํƒ์ง€๋ฅผ ์ฃผ๊ณ , ๋กœ๊ทธ์ธ ๋น„์œจ์„ ๋†’์ด๊ธฐ ์œ„ํ•ด์„œ๋Š” Google ID token๊ณผ password credential์„ ๋ชจ๋‘ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•œ๋‹ค๊ณ  ํ•œ๋‹ค.

     

    1. ๋งŒ์•ฝ username๊ณผ password ๋กœ๊ทธ์ธ์„ ์ œ๊ณตํ•˜๋ ค๋ฉด ์š”์ฒญ์‹œ PasswordRequestOptions ๊ฐ์ฒด๋ฅผ ๊ตฌ์„ฑํ•œ๋‹ค.

    2. ๋งŒ์•ฝ Google Id token์„ ์‚ฌ์šฉํ•œ ๋กœ๊ทธ์ธ์„ ์ œ๊ณตํ•˜๋ ค๋ฉด GoogleInTokenRequestOptions ๊ฐ์ฒด๋ฅผ ๊ตฌ์„ฑํ•œ๋‹ค.

     

    ๋กœ๊ทธ์ธ ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ์œ„ํ•ด GoogleIDTokenRequestOptions.Builder.setFilterByAuthorizedAccounts๋ฅผ true๋กœ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•œ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉ์ž๋Š” credential ๋ฆฌ์ŠคํŠธ๊ฐ€ ๋ณด์—ฌ์ง€๊ธฐ ์ „์— ์ธ์ฆ๋  ์ˆ˜ ์žˆ๋‹ค.

    ํšจ๊ณผ : ์ด๋ฏธ ์•ฑ์— ๋“ฑ๋ก๋œ ๊ณ„์ •์ด ์กด์žฌํ•˜๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์ƒˆ๋กœ์šด ๊ณ„์ •์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค.

     

    BeginSignInRequest ๋Š” ๋กœ๊ทธ์ธ ์‹œ๋„์—์„œ ๋ฐ˜ํ™˜๋œ credential์ด ์ ‘๊ทผ๊ฐ€๋Šฅํ•œ ํƒ€์ž…์ธ์ง€ ํ•„ํ„ฐ๋ง ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋œ๋‹ค.

    ๊ฐ ์ฝ”๋“œ ์„ค๋ช…

    ๋”๋ณด๊ธฐ

     

    // 1. SignInClient๋ฅผ ์ดˆ๊ธฐํ™”ํ•œ๋‹ค.
    //getSignInClient๋Š” google play service์—์„œ ์ œ๊ณต๋˜๋ฉฐ ์›ํƒญ ๋กœ๊ทธ์ธ์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ client๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.
    
    oneTapClient = Identity.getSignInClient(this)
    
    // 2. ์›ํƒญ ๋กœ๊ทธ์ธ์„ ์‹œ์ž‘ํ•˜๊ธฐ ์œ„ํ•œ ์š”์ฒญ์„ ์ƒ์„ฑํ•œ๋‹ค.
    
    signInRequest = BeginSignInRequest.builder() // -> ์ƒˆ๋กœ์šด ์š”์ฒญ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•œ ๋นŒ๋” ๋ฐ˜ํ™˜
    
        .setGoogleIdTokenRequestOptions(
            BeginSignInRequest.GoogleIdTokenRequestOptions.builder()
            
                .setSupported(true) // -> google id token์ด ์ง€์›๋˜๋Š”์ง€ ์—ฌ๋ถ€
              
                .setServerClientId(SERVER_CLIENT_ID)    // -> google cloud console์—์„œ ์ƒ์„ฑํ•œ ์„œ๋ฒ„์šฉ Oauth 2.0 ํด๋ผ์ด์–ธํŠธ ID
              
                .setFilterByAuthorizedAccounts(false) 
                
                // ์‚ฌ์šฉ์ž๊ฐ€ ์•ฑ์— ์ด๋ฏธ ๋กœ๊ทธ์ธ๋˜์–ด์žˆ๋Š” ๊ฒฝ์šฐ์—๋งŒ ์›ํƒญ ๋กœ๊ทธ์ธ์ด ์ž‘๋™ํ•˜๋„๋ก,
                // true์ธ ๊ฒฝ์šฐ ๋กœ๊ทธ์ธ๋˜์–ด์žˆ์ง€ ์•Š๋”๋ผ๋„ ์›ํƒญ ๋กœ๊ทธ์ธ ์ž‘๋™ํ•œ๋‹ค. 
          
                .build()
        )
        .build() // -> ์„ค์ •ํ•œ์˜ต์…˜์œผ๋กœ ์ตœ์ข… SignInRequest ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

    2๏ธโƒฃ ๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž ํ™•์ธ

    ๐Ÿ”ฅ ์ด ๊ณผ์ •์€ ์–ด๋–ป๊ฒŒ ์ง„ํ–‰๋˜๋Š”๊ฒƒ์ธ์ง€ ๋” ์ฐพ์•„๋ณด๊ธฐ

    3๏ธโƒฃ ์›ํƒญ ๋กœ๊ทธ์ธ UI ํ‘œ์‹œ 

     

    ์‚ฌ์šฉ์ž๊ฐ€ ๋กœ๊ทธ์ธํ•˜์ง€ ์•Š์•˜๊ณ , ์›ํƒญ ๋กœ๊ทธ์ธ ์‚ฌ์šฉ์„ ๊ฑฐ๋ถ€ํ•˜์ง€ ์•Š์•˜๋‹ค๋ฉด ํด๋ผ์ด์–ธํŠธ ๊ฐ์ฒด์˜ beginSignIn ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๊ณ  ๋ฐ˜ํ™˜๋˜๋Š” Task์— ๋ฆฌ์Šค๋„ˆ๋ฅผ ์—ฐ๊ฒฐํ•ด์ค€๋‹ค. 

     

    ์‚ฌ์šฉ์ž์—๊ฒŒ ์ €์žฅ๋œ ์•ฑ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๊ฐ€ ์žˆ์„ ๋•Œ  ์›ํƒญ ํด๋ผ์ด์–ธํŠธ๋Š” ์„ฑ๊ณต ๋ฆฌ์Šค๋„ˆ๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

    ๐Ÿ”ฅ   ์•ฑ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ž€ ? 

     

    ์„ฑ๊ณต ๋ฆฌ์Šค๋„ˆ์˜ task ๊ฒฐ๊ณผ์—์„œ ๋Œ€๊ธฐ ์ค‘์ธ ์ธํ…ํŠธ๋ฅผ ๊ฐ€์ ธ์™€ startIntentSenderForResult( ) ์— ์ „๋‹ฌํ•˜์—ฌ ์›ํƒญ ๋กœ๊ทธ์ธ UI๋ฅผ ์‹œ์ž‘ํ•œ๋‹ค.

     

    ์‚ฌ์šฉ์ž์—๊ฒŒ ์ €์žฅ๋œ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ ์›ํƒญ ํด๋ผ์ด์–ธํŠธ๋Š” ์‹คํŒจ ๋ฆฌ์Šค๋„ˆ๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค. ๋ณ„๋„์˜ ์กฐ์น˜๋Š” ํ•„์š”ํ•˜์ง€ ์•Š๋‹ค.

    ์•ฑ์˜ ๋กœ๊ทธ์•„์›ƒ ํ™˜๊ฒฝ์„ ๊ณ„์† ํ‘œ์‹œํ•ด์ฃผ๋ฉด ๋œ๋‹ค. 

     

    	binding.googleLoginBtn.setOnClickListener {
                // Begin the One Tap sign-in flow
                oneTapClient.beginSignIn(signInRequest)
                    .addOnSuccessListener(this) { result ->
                        try {
                            // Start the One Tap UI
                            startIntentSenderForResult(
                                result.pendingIntent.intentSender, REQ_ONE_TAP,
                                null, 0, 0, 0, null
                            )
                        } catch (e: IntentSender.SendIntentException) {
                            Log.e("Google", "Couldn't start One Tap UI: ${e.localizedMessage}")
                        }
                    }
                    .addOnFailureListener(this) { e ->
                        // Handle failure (no saved credentials found)
                        Log.d("Google", e.localizedMessage)
                    }
            }

    4๏ธโƒฃ ์‚ฌ์šฉ์ž ์‘๋‹ต ์ฒ˜๋ฆฌ 

    ์›ํƒญ ๋กœ๊ทธ์ธ ๋ฉ”์‹œ์ง€์— ๋Œ€ํ•œ ์‚ฌ์šฉ์ž์˜ ์‘๋‹ต์€ Activity์˜ onActivityResult ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์•ฑ์— ๋ณด๊ณ ๋œ๋‹ค. 

    ์‚ฌ์šฉ์ž๊ฐ€ ๋กœ๊ทธ์ธ์„ ์„ ํƒํ•œ ๊ฒฝ์šฐ ์ €์žฅ๋œ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๊ฐ€ ๊ฒฐ๊ณผ์— ํ‘œ์‹œ๋œ๋‹ค. 

    ์‚ฌ์šฉ์ž๊ฐ€ ์›ํƒญ UI๋ฅผ ๋‹ซ๊ฑฐ๋‚˜ ๋กœ๊ทธ์ธ์„ ๊ฑฐ๋ถ€ํ•˜๋ฉด RESULT_CANCELED ์ฝ”๋“œ์™€ ํ•จ๊ป˜ ๊ฒฐ๊ณผ๊ฐ€ ๋ฐ˜ํ™˜๋œ๋‹ค. ์ด ๋‘๊ฐ€์ง€๋ฅผ ๋ชจ๋‘ ์ฒ˜๋ฆฌํ•ด์ค˜์•ผํ•œ๋‹ค.

     

    ๊ฐ€์ ธ์˜จ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋กœ ๋กœ๊ทธ์ธ

    ์‚ฌ์šฉ์ž๊ฐ€ ์•ฑ๊ณผ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ๊ณต์œ ํ•˜๊ธฐ๋กœ ์„ ํƒํ•œ ๊ฒฝ์šฐ onActivityResult ( )์˜ ์ธํ…ํŠธ ๋ฐ์ดํ„ฐ๋ฅผ ์›ํƒญ ํด๋ผ์ด์–ธํŠธ์˜ getSignInCredentialFromIntent( ) ๋ฉ”์„œ๋“œ์— ์ „๋‹ฌํ•˜์—ฌ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ๋‹ค.

     

    ์‚ฌ์šฉ์ž๊ฐ€ ์•ฑ๊ณผ google ๊ณ„์ • ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ๊ณต์œ ํ•œ ๊ฒฝ์šฐ์—๋Š” ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด์— null ์ด ์•„๋‹Œ googleIdToken ์†์„ฑ์ด ์žˆ๊ณ , ์‚ฌ์šฉ์ž๊ฐ€ ์ €์žฅ๋œ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๊ณต์œ ํ•œ ๊ฒฝ์šฐ์—๋Š” null ์•„๋‹Œ password ์†์„ฑ์ด ์žˆ๋‹ค.

     

    ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์•ฑ์˜ ๋ฐฑ์—”๋“œ์— ์ธ์ฆํ•œ๋‹ค.

    ๐Ÿ”ฅ   ์ด ๋•Œ ์„œ๋ฒ„์— ์ธ์ฆ์ •๋ณด๋ฅผ ๋ณด๋‚ด์ฃผ๋Š” ๊ฒƒ์ธ๊ฐ€??

    - ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ ์Œ์„ ๊ฐ€์ ธ์˜จ ๊ฒฝ์šฐ ์‚ฌ์šฉ์ž๊ฐ€ ์ˆ˜๋™์œผ๋กœ ์ œ๊ณตํ•œ ๊ฒƒ๊ณผ ๋™์ผํ•œ ๋ฐฉ์‹์œผ๋กœ ๋กœ๊ทธ์ธํ•œ๋‹ค.

    - google ๊ณ„์ • ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์™”์œผ๋ฉด ID ํ† ํฐ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐฑ์—”๋“œ์— ์ธ์ฆํ•œ๋‹ค.

     

      // 4. ์‚ฌ์šฉ์ž ์‘๋‹ต ์ฒ˜๋ฆฌ
        override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
            super.onActivityResult(requestCode, resultCode, data)
            when (requestCode) {
                REQ_ONE_TAP -> {
                    try {
                        val credential = oneTapClient.getSignInCredentialFromIntent(data)
                        val idToken = credential.googleIdToken
                        val username = credential.id
                        val password = credential.password
                        
                        when {
                            idToken != null -> {
                                // Handle successful sign-in
                                Log.d("Google", "Got ID token: $idToken")
                                // You can now use this ID token for authentication or other purposes
                            } 
                            password != null -> {
                                Log.d("Google","Got password")
                            }
                            else -> {
                                Log.d("Google","no id token or password")
                            }
                        }
                  
                    } 
                }
            }
        }

     


    ์›ํƒญ UI ํ‘œ์‹œ ์ค‘์ง€

     

    ์‚ฌ์šฉ์ž๊ฐ€ ๋กœ๊ทธ์ธ์„ ๊ฑฐ๋ถ€ํ•œ ๊ฒฝ์šฐ getSignInCredentialFromIntent( )๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด CommonStatusCodes.CANCELDED ์ƒํƒœ ์ฝ”๋“œ์™€ ํ•จ๊ป˜ ApiException์ด ๋ฐœ์ƒํ•œ๋‹ค. ์ด ๊ฒฝ์šฐ์—๋Š” ์›ํƒญ ๋กœ๊ทธ์ธ UI๋ฅผ ์ผ์‹œ์ ์œผ๋กœ ์‚ฌ์šฉ ์ค‘์ง€ํ•˜์—ฌ ์‚ฌ์šฉ์ž๋“ค๋กœ ํ•˜์—ฌ๊ธˆ ๋ถˆํŽธํ•œ ๊ฐ์ •์„ ๋Š๋ผ๊ฒŒ ํ•˜์ง€ ์•Š๋„๋ก ํ•ด์•ผํ•œ๋‹ค. 

     

    ์›ํƒญ ๋กœ๊ทธ์ธ ๋ฉ”์‹œ์ง€์˜ ๋น„์œจ ์ œํ•œ์„ ์ง์ ‘ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค. ์•„๋‹ˆ๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ์—ฌ๋Ÿฌ ๋ฉ”์‹œ์ง€๋ฅผ ์—ฐ์†์œผ๋กœ ์ทจ์†Œํ•˜๋ฉด ์›ํƒฌ ํด๋ผ์ด์–ธํŠธ๋Š” 24์‹œ๊ฐ„ ์ฟจ๋‹ค์šด ๊ธฐ๊ฐ„์ด ๋ฐœ์ƒํ•˜์—ฌ ์›ํƒญ ๋กœ๊ทธ์ธ UI๊ฐ€ ํ‘œ์‹œ๋˜์ง€ ์•Š๋Š”๋‹ค.

    catch (e: ApiException) {
                        when (e.statusCode) {
                            CommonStatusCodes.CANCELED-> {
                                Log.d("๊ตฌ๊ธ€","์›ํƒญ ๋‹ค์ด์–ผ๋Ÿฌ๊ทธ was closed")
                                showOneTapUI = false
                            }
                        }

     

    ์ •ํ™•ํžˆ ์–ด๋–ค ์ž‘์—…์„ ํ•˜๋Š”์ง€ ๋กœ๊ทธ๋กœ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์›ํƒญ UI ์ฐฝ์„ ์—ฌ๋Ÿฌ ๋ฒˆ ํƒญํ–ˆ๋”๋‹ˆ ๊ฐ‘์ž๊ธฐ ๋กœ๊ทธ์ธ ์ฐฝ์ด ๋œจ์ง€ ์•Š๋Š”๋‹ค...! 

    ์—๋Ÿฌ ๋‚ด์šฉ์„ ํ™•์ธํ•ด๋ณด๋‹ˆ  16: Caller has been temporarily blocked due to too many canceled sign-in prompts. 

    ๊ณต์‹๋ฌธ์„œ๋ฅผ ํ™•์ธํ•ด๋ณด๋‹ˆ ์ฟจ๋‹ค์šด ๊ธฐ๊ฐ„์ด ๋ฐœ์ƒํ•œ ๊ฒƒ์ด์—ˆ๋‹ค! 

     

    ์›ํƒญ ๋‹ค์ด์–ผ๋กœ๊ทธ ์ฐฝ์„ ๋‹ซ์œผ๋ฉด ์•„๋ž˜์˜ ๋กœ๊ทธ๊ฐ€ ๋œฌ๋‹ค.


    5๏ธโƒฃ  ๋กœ๊ทธ์•„์›ƒ ์ฒ˜๋ฆฌ

    signOut ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด ๋œ๋‹ค.

        // 5. ๋กœ๊ทธ์•„์›ƒ  ์ฒ˜๋ฆฌ 
            binding.googleLoginOutBtn.setOnClickListener{
    
                oneTapClient.signOut()
    
            }

     

     

    ๐Ÿ”ฅ๋‹ค์Œ ์ด์•ผ๊ธฐ

    ๊ณต์‹์—์„œ ๊ถŒ์žฅํ•˜๋Š” ์ธ์ฆ ๊ด€๋ฆฌ์ž๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ์„ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•ด๋ณด์ž.

    ๋˜ํ•œ ์›ํƒญ ๋กœ๊ทธ์ธ UI ์ค‘ google ID token์ด ์•„๋‹ˆ๋ผ password credential๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๊ตฌํ˜„ํ•ด๋ณด๋„๋ก ํ•œ๋‹ค.

     

    728x90