Computer Science/Flutter

[Flutter Google Login] ๊ตฌ๊ธ€ ์†Œ์…œ ๋กœ๊ทธ์ธ ์—๋Ÿฌ PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)

_cactus 2024. 1. 25. 15:06
๋ฐ˜์‘ํ˜•

Flutter์—์„œ ๊ตฌ๊ธ€ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ๊ตฌํ˜„ํ•˜๋Š” ์ž‘์—…์„ ์ง„ํ–‰ํ•˜๋˜ ์ค‘ ์•ˆ๋“œ๋กœ์ด๋“œ์ชฝ์—์„œ ๋ง์ฝ์ด ์ƒ๊ฒผ๋‹ค. ๐Ÿ˜ฐ

์ผ๋‹จ ๋‚˜๋Š” google_sign_in ํŒจํ‚ค์ง€๋ฅผ ์‚ฌ์šฉํ–ˆ๋‹ค. 

๊ตฌ๊ธ€ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ์œ„ํ•ด์„œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๋ฉด

GoogleSignIn _googleSignInAccount = await _googleSignIn.signIn();

๊ตฌ๊ธ€ ๊ณ„์ •์˜ displayName, email, serverAuthCode, idToken๋“ฑ์„ response๋กœ ๋‚ด๋ ค์ค€๋‹ค.

์ด reponse๊ฐ€ ์ œ๋Œ€๋กœ ๋“ค์–ด์™€์•ผ ๊ตฌ๊ธ€๊ณ„์ •์— ๋กœ๊ทธ์ธ์„ ์„ฑ๊ณตํ•˜๊ฒŒ ๋˜๋Š” ๊ฒƒ์ด๋‹ค.

 

๋ฌธ์ œ๋Š”...

๋ถ„๋ช… Android studio์—์„œ ๋นŒ๋“œํ•ด์„œ ํ…Œ์ŠคํŠธํ•  ๋•Œ๋Š” reponse๊ฐ€ ์ž˜ ๋“ค์–ด์™”๋Š”๋ฐ ์•ฑ์„ ๋ฐฐํฌ ํ›„์— ํ…Œ์ŠคํŠธํ•ด๋ณด๋‹ˆ๊นŒ ๊ณ„์† 

PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)

ํ•ด๋‹น ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค...

์ง„์งœ ์›์ธ์„ ๋ชป ์ฐพ๊ณ  ๋ช‡์‹œ๊ฐ„์„ ํ—ค๋งค์ด๋‹ค ์›์ธ์„ ์ฐพ์•˜๋‹ค !!! ๐Ÿ˜ญ

 

์›์ธ์€ ๋ฐ”๋กœ..

SHAํ‚ค๊ฐ’์ด ๋ฐฐํฌ์šฉํ‚ค๋กœ ์„ค์ •๋˜์–ด์žˆ์–ด์„œ ๊ทธ๋Ÿฐ๊ฒƒ์ด์˜€๋‹ค.

๋ฐฐํฌ์šฉ, ๋””๋ฒ„๊ทธ์šฉ ๋‘˜ ๋‹ค ๊ตฌ๊ธ€ ์†Œ์…œ ๋กœ๊ทธ์ธ ํ…Œ์ŠคํŠธ๋ฅผ ํ•˜๋ ค๋ฉด Android OAuth 2.0 ํด๋ผ์ด์–ธํŠธ ID๋ฅผ ๊ฐ๊ฐ ๋”ฐ๋กœ!!!!!!! ์„ค์ •ํ•ด์•ผํ•œ๋‹ค. 

๊ทผ๋ฐ ๋‚˜๋Š” ๋ฐฐํฌ์šฉ๋งŒ ๋งŒ๋“ค์–ด๋†จ๋˜ ๊ฒƒ..!

 

 

Google Cloud Console์— ์ ‘์†ํ•˜์—ฌ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด ํ™”๋ฉด์—์„œ OAuth 2.0 ํด๋ผ์ด์–ธํŠธ ID๋ฅผ ๋””๋ฒ„๊ทธ์šฉ์œผ๋กœ ํ•˜๋‚˜ ๋” ์ƒ์„ฑํ•ด์ค€๋‹ค.

์ด๋ฆ„์€ ๊ทธ๋ƒฅ ๋‚ด๊ฐ€ ์•Œ์•„๋ณด๊ธฐ ์‰ฝ๊ฒŒ ์„ค์ •ํ•ด์ฃผ๋ฉด ๋˜๊ณ , 

ํŒจํ‚ค์ง€ ์ด๋ฆ„์€ ๋ฐฐํฌ์šฉ, ๋””๋ฒ„๊ทธ์šฉ ๋™์ผํ•˜๊ฒŒ ์„ค์ •ํ•ด์ค€๋‹ค.

๊ทธ๋ฆฌ๊ณ  SHA-1 ์ธ์ฆ์„œ ๋””์ง€ํ„ธ ์ง€๋ฌธ์— ๋“ค์–ด๊ฐ€์•ผํ•  ํ‚ค๊ฐ€ ์ค‘์š”ํ•˜๋‹ค. 

์ด ํ‚ค๊ฐ’์„ ์–ด๋””์„œ ์•Œ์•„์˜ค๋Š๋ƒ...?  (โ–ผโ–ผโ–ผ ์•„๋ž˜ ๊ธ€ ์ฐธ๊ณ )

2024.01.24 - [Computer Science/Flutter] - [์•ˆ๋“œ๋กœ์ด๋“œ] Debug, Release SHA key ์ถ”์ถœ ๋ฐฉ๋ฒ•

 

[์•ˆ๋“œ๋กœ์ด๋“œ] Debug SHA key ์ถ”์ถœ ๋ฐฉ๋ฒ•

1. Gradle ์ด์šฉ gradle ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•ด์„œ ์ถ”์ถœํ•  ์ˆ˜ ์žˆ๋‹ค. ์•ˆ๋“œ๋กœ์ด๋“œ ํด๋”๋กœ ๊ฐ€์„œ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ณ์ฃผ๋ฉด ๋! ./gradlew signingReport ์•„๋ž˜์™€ ๊ฐ™์ด ์ถœ๋ ฅ๋˜๋Š”๋ฐ SHA1, SHA256์„ ํ™•์ธํ•˜๋ฉด ๋œ๋‹ค! > Task :app:signingRep

mac-user-guide.tistory.com

 

 

์ด๋ ‡๊ฒŒ ์„ค์ •ํ•ด์ฃผ๊ณ , 

 

๋˜ ์žŠ์ง€๋ง ๊ฒƒ...!!!

Firebase์—์„œ ๋‚ด ํ”„๋กœ์ ํŠธ์˜ ํ•ด๋‹น ์•ฑ ์„ค์ •์—์„œ SHA key๋“ค์„ ์ œ๋Œ€๋กœ ์—…๋ฐ์ดํŠธ ํ•ด์ค˜์•ผํ•œ๋‹ค.!!!

๊ทธ๋ฆฌ๊ณ  google-services.json ํŒŒ์ผ์„ ๋‹ค์‹œ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์•„์„œ ๋‚ด ํ”„๋กœ์ ํŠธ ํด๋” ๋‚ด android/app/ ์•„๋ž˜ ๋„ฃ์–ด์ฃผ๋ฉด ๋!!!

 

๋ฐฐํฌ์šฉํ‚ค์— ๋””๋ฒ„๊ทธ์šฉํ‚ค๋ฅผ ๋„ฃ์–ด์„œ ๋””๋ฒ„๊ทธํ•  ๋•Œ๋Š” ์ž˜๋˜๊ณ  ๋ฐฐํฌ ์•ฑ์—์„  ๋™์ž‘ ์•ˆํ•˜๋˜ ๊ฒƒ..!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•