Firebase-tools: ADC ์ธ์ฆ ์˜ค๋ฅ˜: ์ด ์š”์ฒญ์—๋Š” ๋ฒ”์œ„๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2018๋…„ 05์›” 29์ผ  ยท  46์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: firebase/firebase-tools

์•ˆ๋…•ํ•˜์„ธ์š”, Firebase ๊ธฐ๋Šฅ ๋ฐฐํฌ๋ฅผ ์ž๋™ํ™”ํ•˜๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. "GOOGLE_APPLICATION_CREDENTIALS=ํŒŒ์ด์–ด๋ฒ ์ด์Šค ์‚ฌ์šฉ--non-interactive --debugโ€ ์•„๋ž˜ ์˜ค๋ฅ˜๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ฒ„์ „ ์ •๋ณด

3.18.5

ํ”Œ๋žซํผ ์ •๋ณด

์ปจํ…Œ์ด๋„ˆ ๋…ธ๋“œ:6.14-alpine

์žฌํ˜„ ๋‹จ๊ณ„

/usr/bin/docker run --rm -v /workspace:/workspace -e GOOGLE_APPLICATION_CREDENTIALS=node:6.14-alpine node_modules/firebase-tools/bin/firebase ์‚ฌ์šฉ--๋””๋ฒ„๊ทธ

์˜ˆ์ƒ๋˜๋Š” ํ–‰๋™

์ธ์ฆ๋ฐ›๊ธฐ ์œ„ํ•ด

์‹ค์ œ ํ–‰๋™

[2018-05-29T15:57:32.507Z] > ๋ช…๋ น์—๋Š” ๋ฒ”์œ„๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. [โ€œemailโ€,โ€œopenidโ€,โ€œhttps://www.googleapis.com/auth/cloudplatformprojects.readonlyโ€œ,โ€https://www .googleapis.com/auth/firebaseโ€]
[2018-05-29T15:57:32.507Z] > ์•ฑ ๊ธฐ๋ณธ ์ž๊ฒฉ ์ฆ๋ช…์„ ํ†ตํ•ด ์ธ์ฆ ์‹œ๋„
[2018-05-29T15:57:32.547Z] ! ์ž๋™ ์ธ์ฆ ์˜ค๋ฅ˜: ์ด ์š”์ฒญ์—๋Š” ๋ฒ”์œ„๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
[2018-05-29T15:57:32.547Z] > ์ž๊ฒฉ ์ฆ๋ช…์„ ์ฐพ๊ฑฐ๋‚˜ ์ž๋™์œผ๋กœ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

๋ช‡ ๊ฐ€์ง€ ์ œ์•ˆ ์‚ฌํ•ญ์ด ์žˆ์Šต๋‹ˆ๊นŒ?

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

@mbleigh ์–ด๋–ค ์—…๋ฐ์ดํŠธ? ํ˜„์žฌ Firebase CLI์—์„œ ์„œ๋น„์Šค ๊ณ„์ •์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐฐํฌํ•  ์ˆ˜ ์—†์Œ์„ ํ™•์ธํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ? ์šฐ๋ฆฌ๋Š” CI ๋„๊ตฌ๋ฅผ ์›ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ GOOGLE_APPLICATION_CREDENTIALS ์ง€์›์ด ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๊นŒ?

๋ชจ๋“  46 ๋Œ“๊ธ€

์•ˆ๋…•ํ•˜์„ธ์š”, ํ•„์š”ํ•œ ์ž๊ฒฉ ์ฆ๋ช…์€ GOOGLE_APPLICATION_CREDENTIALS๊ฐ€ ์•„๋‹ˆ๋ฏ€๋กœ ํ•ด๋‹น ์ค„์ด ์‹ค์ œ๋กœ ๋„์›€์ด ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

CI ํ† ํฐ์„ ์ƒ์„ฑํ•œ ๋‹ค์Œ --token ํ”Œ๋ž˜๊ทธ์™€ ํ•จ๊ป˜ ๋ช…๋ น์„ ์‹คํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ https://github.com/firebase/firebase-tools#using -with-ci-systems๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

์•ˆ๋…•ํ•˜์„ธ์š”,
https://github.com/firebase/firebase-tools/pull/417์€ ์–ด๋–ป์Šต๋‹ˆ๊นŒ?
GOOGLE_APPLICATION_CREDENTIALS๊ฐ€ ๊ตฌํ˜„๋˜๊ณ  firebase-tools๊ฐ€ ์ด๋ฅผ ์–ป๊ธฐ ์œ„ํ•ด google-auto-auth๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์•„๋‹ˆ๋ฉด ๋‚ด๊ฐ€ ํ‹€๋ ธ์–ด?

Google ์‚ฌ์šฉ์ž(GSuite ๋˜๋Š” Cloud ID ๋“ฑ)๊ฐ€ ์•„๋‹Œ ์„œ๋น„์Šค ๊ณ„์ •์œผ๋กœ ์ธ์ฆํ•˜๊ณ  ์‹ถ๊ธฐ ๋•Œ๋ฌธ์— CI ํ† ํฐ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค

์•ˆ๋…•ํ•˜์„ธ์š”,
๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ firebase-public.firebaseio๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. com:443 ์ด๊ณ  HTTP ๋ฐ˜ํ™˜ ์ฝ”๋“œ๋Š” 200์ด์ง€๋งŒ ์‘๋‹ต์€ 0๋ฐ”์ดํŠธ์ž…๋‹ˆ๋‹ค.

์•ˆ๋…•ํ•˜์„ธ์š”, ๋‹น์‹ ์ด ๋งž์Šต๋‹ˆ๋‹ค. ์ฃ„์†กํ•ฉ๋‹ˆ๋‹ค, ๊ทธ ํ™๋ณด๋ฅผ ์žŠ์–ด๋ฒ„๋ ธ์Šต๋‹ˆ๋‹ค. ๋‚˜๋Š” ์ด๊ฒƒ์— ์ต์ˆ™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋งˆ์ดํด, ์‚ฌ๋ฌด์‹ค์— ๋Œ์•„์˜ค๋ฉด ์ข€ ๋ด์ฃผ์‹œ๊ฒ ์–ด์š”?

์•ˆ๋…•ํ•˜์„ธ์š” @laurenzlong @mbleigh ,
์„œ๋น„์Šค ๊ณ„์ •์— ๋Œ€ํ•ด "Domain Wide Authority"๋ฅผ ๊ตฌ์„ฑํ•˜๋ฉด ์ธ์ฆ์ด ํ—ˆ์šฉ๋œ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ์•˜์Šต๋‹ˆ๋‹ค.
๊ทธ๋Ÿฌ๋‚˜ ์ด์ œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

GOOGLE_APPLICATION_CREDENTIALS=<path_to_json> firebase deploy --only functions --non-interactive --project=<project_id> --debug

[2018-06-04T09:25:46.202Z] ----------------------------------------------------------------------
[2018-06-04T09:25:46.211Z] CLI Version:   3.18.5
[2018-06-04T09:25:46.212Z] Platform:      linux
[2018-06-04T09:25:46.212Z] Node Version:  v6.14.2
[2018-06-04T09:25:46.212Z] Time:          Mon Jun 04 2018 09:25:46 GMT+0000 (UTC)
[2018-06-04T09:25:46.213Z] ----------------------------------------------------------------------

[2018-06-04T09:25:46.238Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2018-06-04T09:25:46.238Z] > attempting to authenticate via app default credentials
[2018-06-04T09:25:46.445Z] xxxx.x.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xx
[2018-06-04T09:25:46.446Z] > retrieved access token via default credentials
[2018-06-04T09:25:46.449Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/<project_id>  

 Mon Jun 04 2018 09:25:46 GMT+0000 (UTC)
[2018-06-04T09:25:47.067Z] <<< HTTP RESPONSE 404 server=nginx, date=Mon, 04 Jun 2018 09:25:47 GMT, content-type=application/json; charset=utf-8, content-length=87, connection=close, x-content-type-options=nosniff
[2018-06-04T09:25:47.069Z] <<< HTTP RESPONSE BODY code=PROJECT_NOT_FOUND, message=The specified project was not found.

์„œ๋น„์Šค ๊ณ„์ •์— ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•œ ํŽธ์ง‘์ž ๊ถŒํ•œ์ด ์žˆ์œผ๋ฉฐ svc ๊ณ„์ •์ด ์•„๋‹Œ Google ID๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ๋ฌธ์ œ๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์ด ๋น„์Šทํ•œ ๋ฌธ์ œ๋ฅผ ์ฐพ์•˜์ง€๋งŒ (ํ† ํฐ์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค) https://github.com/firebase/firebase-tools/issues/744

๊ฐ์‚ฌ ํ•ด์š”

์•„๋‹ˆ, ๋‚ด๊ฐ€ ํ‹€๋ ธ์–ด.
Firebase ์‚ฌ์šฉ์„ ์‹คํ–‰ํ•˜๋ฉด ๋‹ค์‹œ ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

[2018-06-04T14:39:38.660Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
[2018-06-04T14:39:38.660Z] > attempting to authenticate via app default credentials
[2018-06-04T14:39:38.693Z] ! auto-auth error: Scopes are required for this request.
[2018-06-04T14:39:38.694Z] > no credentials could be found or automatically retrieved

Owner ์—ญํ• ์ด ํ• ๋‹น๋œ ์„œ๋น„์Šค ๊ณ„์ •์ด firebase CLI ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌด์—‡์ด๋“  ํ•˜๋ ค๊ณ  ํ•˜๋Š” ๊ฒฝ์šฐ์—๋„ ๋™์ผํ•œ ๋™์ž‘:

$ export GOOGLE_APPLICATION_CREDENTIALS=account.json
$ firebase list --debug
[2018-06-05T12:15:17.340Z] ----------------------------------------------------------------------
[2018-06-05T12:15:17.343Z] Command:       /usr/local/bin/node /usr/local/bin/firebase list --debug
[2018-06-05T12:15:17.343Z] CLI Version:   3.18.5
[2018-06-05T12:15:17.343Z] Platform:      linux
[2018-06-05T12:15:17.343Z] Node Version:  v10.3.0
[2018-06-05T12:15:17.343Z] Time:          Tue Jun 05 2018 12:15:17 GMT+0000 (UTC)
[2018-06-05T12:15:17.343Z] ----------------------------------------------------------------------

[2018-06-05T12:15:17.347Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
[2018-06-05T12:15:17.348Z] > attempting to authenticate via app default credentials
[2018-06-05T12:15:17.352Z] ! auto-auth error: Scopes are required for this request.
[2018-06-05T12:15:17.352Z] > no credentials could be found or automatically retrieved

Error: Command requires authentication, please run firebase login

์‚ฌ์†Œํ•œ ๋‹จ์„œ๋Š” ์•ก์„ธ์Šค ํ† ํฐ์ด ๋น„์–ด ์žˆ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค(๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ๊ณ  JWT๋ฅผ ๋””์ฝ”๋”ฉํ–ˆ์Šต๋‹ˆ๋‹ค).

๊ทธ ํ˜•ํƒœ์—์„œ ์•”์‹œ
xxxx.x.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

์ค‘๊ฐ„ x๋Š” ๋ฐ์ดํ„ฐ ํŽ˜์ด๋กœ๋“œ์ด๊ณ  ํฌ๊ธฐ๊ฐ€ 1์ž์ด๋ฏ€๋กœ ๋ถ„๋ช…ํžˆ ๊ฐ€๋“ ์ฐจ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

firebase-tools๋Š” google-auto-auth๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ† ํฐ์„ ๊ฐ€์ ธ์˜ค๋ฏ€๋กœ ๋ฌธ์ œ๊ฐ€ ์žˆ์„ ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

์ด๋Ÿฐ, ์ƒˆ ๋ฒ„์ „( 3.18.6 )์€ ์—ฌ์ „ํžˆ authScopes ์„ autoAuth() ๋กœ ์ „๋‹ฌํ•˜์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ด ์ค„ ์•ž์— ๋กœ๊ทธ ๋ฌธ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒฝ์šฐ: https://github.com/firebase/firebase-tools/blob/b2594467d8980c5a1e2b8c4aff3de9877a98b42b/lib/requireAuth.js#L21
authScopes: undefined ๋ฐ›์Šต๋‹ˆ๋‹ค.

๋‚ด๊ฐ€ ์ถ”๊ฐ€ํ•˜๋ฉด

authScopes = [
  scopes.EMAIL,
  scopes.OPENID,
  scopes.CLOUD_PROJECTS_READONLY,
  scopes.FIREBASE_PLATFORM,
];

๊ทธ ์ค„ ์ด์ „์— ์•ก์„ธ์Šค ํ† ํฐ ํš๋“์„ ์ง„ํ–‰ํ•˜์ง€๋งŒ PROJECT_NOT_FOUND ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค.

๋˜ํ•œ @tomlarkworthy , ํ•ด๋‹น OAuth ํ† ํฐ์€ JWT๊ฐ€ ์•„๋‹ˆ๋ฏ€๋กœ ์ค‘๊ฐ„ ๋ถ€๋ถ„์„ ํฌํ•จํ•˜์ง€ ์•Š์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค. https://developers.google.com/apis-explorer/#search/oauth2/oauth2/v2/oauth2.tokeninfo ์—์„œ ์‹คํ–‰ํ•˜๋ฉด "scope": "https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/firebase https://www.googleapis.com/auth/userinfo.email", ์™€ ํ•จ๊ป˜ ์œ ํšจํ•œ ํ† ํฐ์œผ๋กœ ๋ณด๊ณ ๋ฉ๋‹ˆ๋‹ค.

๊ฐ์‚ฌ ํ•ด์š”! ํ™•์ธ ๊ทธ๋ž˜์„œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ํ† ํฐ์„ ๋””์ฝ”๋”ฉํ•  ๋•Œ " https://www.googleapis.com/auth/cloud-platform " ๋ฒ”์œ„๊ฐ€ ํ•˜๋‚˜๋งŒ ์žˆ์Šต๋‹ˆ๋‹ค.

"์ •์ƒ์ ์ธ"ํ† ํฐ (์„ ํ†ตํ•ด ํš๋“ ์ฆ‰, ํ•˜๋‚˜์˜ ์ฐจ์ด๊ฐ€ firebase login ) :

{
 "issued_to": "563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com",
 "audience": "563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com",
 "user_id": "xxxyyy",
 "scope": "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase https://www.googleapis.com/auth/plus.me",
 "expires_in": 3484,
 "email": "[email protected]",
 "verified_email": true,
 "access_type": "offline"
}

์„œ๋น„์Šค ๊ณ„์ •(SA)์—์„œ ์ƒ์„ฑ๋œ ๊ณ„์ •:

{
 "issued_to": "1160xxxx",
 "audience": "1160xxxx",
 "user_id": "1160xxxx",
 "scope": "https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/firebase https://www.googleapis.com/auth/userinfo.email",
 "expires_in": 3563,
 "email": "[email protected]",
 "verified_email": true,
 "access_type": "offline"
}

๋”ฐ๋ผ์„œ ํ† ํฐ์€ https://github.com/firebase/firebase-tools/blob/376678fef91f71de5859f14d8374b2d8d2731980/์— ์žˆ์–ด์•ผ ํ•˜๋Š” ์˜ฌ๋ฐ”๋ฅธ audience ๋ฐ user_id ๋ฐœํ–‰๋˜์ง€ ์•Š์€ ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค. lib/api.js#L84

@tomlarkworth๋Š” ์—ฌ์ „ํžˆ ์ด์ƒํ•ฉ๋‹ˆ๋‹ค. ์˜ฌ๋ฐ”๋ฅธ ๋ฒ”์œ„๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ ์ถ”๊ฐ€ํ•˜์ง€ ์•Š๋Š” ํ•œ ๋‚ด authScope ๋Š” undefined ์ž…๋‹ˆ๋‹ค. ์ด ํ•ญ๋ชฉ์„ ์‹คํ–‰ํ•˜๊ธฐ ์ „์— firebase logout ๋ฅผ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๊นŒ?

ํด๋ผ์ด์–ธํŠธ ID๋Š” oath2 ํด๋ผ์ด์–ธํŠธ์ด๋ฉฐ ์ž‘๋™ํ•  ์ˆ˜ ์žˆ๋Š” ๋งค์šฐ ๊ตฌ์ฒด์ ์ธ ๋„๋ฉ”์ธ์ด ์žˆ์œผ๋ฏ€๋กœ ์šฐ๋ฆฌ์˜ ์†์ด ๋‹ฟ์ง€ ์•Š๋Š” ๊ณณ์— ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค. ๋ฐ/๋˜๋Š” localhost์—์„œ ์‚ฌ์šฉ์ž ์ƒํ˜ธ ์ž‘์šฉ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ CI์—์„œ ์Šน์ธ์„ ๋ฐ›๊ธฐ๊ฐ€ ๋งค์šฐ ์–ด๋ ต์Šต๋‹ˆ๋‹ค.

๋‚ด ๊ธฐ๋Šฅ์„ ์‹คํ–‰ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋‚˜๋Š” ๋‹น์‹ ๊ณผ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ์—†์—ˆ์Šต๋‹ˆ๋‹ค. ์›๋ณธ ํฌ์Šคํ„ฐ์ฒ˜๋Ÿผ ์ฐพ์„ ์ˆ˜ ์—†๋Š” ํ”„๋กœ์ ํŠธ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

์„œ๋น„์Šค ๊ณ„์ •์—์„œ ์ž์ฒด ํ† ํฐ์„ ๊ตฌ์„ฑํ•˜๊ณ  --token๊ณผ ํ•จ๊ป˜ ์ „๋‹ฌํ•˜๋ฉด ๋‹ค์Œ์„ ์–ป์Šต๋‹ˆ๋‹ค.

HTTP ์‘๋‹ต 401 vary=X-Origin, Origin,Accept-Encoding, www-authenticate=Bearer realm=" https://accounts.google.com/ ", content-type=application/json; charset=UTF-8, ๋‚ ์งœ=๋ชฉ, 2018๋…„ 6์›” 7์ผ 00:16:43 GMT, ๋งŒ๋ฃŒ=๋ชฉ, 2018๋…„ 6์›” 7์ผ 00:16:43 GMT, cache-control=private, max-age=0, x-content- type-options=nosniff, x-frame-options=SAMEORIGIN, x-xss-protection=1; ๋ชจ๋“œ=๋ธ”๋ก, ์„œ๋ฒ„=GSE, Alt-svc=quic=":443"; ma=2592000; v="43,42,41,39,35", ํ—ˆ์šฉ ๋ฒ”์œ„=์—†์Œ, ์—ฐ๊ฒฐ=๋‹ซ๊ธฐ
[2018-06-07T00:16:43.786Z] <<< HTTP RESPONSE BODY error=unauthorized_client, error_description=Unauthorized
[2018-06-07T00:16:43.791Z] > ๋ช…๋ น์—๋Š” ๋ฒ”์œ„๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www .googleapis.com/auth/firebase"]
[2018-06-07T00:16:43.792Z] > --token ์˜ต์…˜์„ ํ†ตํ•œ ๊ถŒํ•œ ๋ถ€์—ฌ
[2018-06-07T00:16:43.792Z] > ๋ฒ”์œ„๊ฐ€ ์žˆ๋Š” ์•ก์„ธ์Šค ํ† ํฐ ์ƒˆ๋กœ ๊ณ ์นจ: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https:/ /www.googleapis.com/auth/firebase"]
[2018-06-07T00:16:43.793Z] >>> HTTP ์š”์ฒญ ๊ฒŒ์‹œ๋ฌผ https://www.googleapis.com/oauth2/v3/token
{ ์ƒˆ๋กœ๊ณ ์นจ ํ† ํฐ: 'ya29.c.XXXXXXXXXXXX',
client_id: '563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com',
client_secret: 'j9iVZfS8kkCEFUPaAeJV0sAi',
Grant_type: '์ƒˆ๋กœ๊ณ ์นจ_ํ† ํฐ',
๋ฒ”์œ„: '์ด๋ฉ”์ผ openid https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase ' }

์ด ๋งน์„ธ ํด๋ผ์ด์–ธํŠธ ID๊ฐ€ ๋ฐฉํ•ด๊ฐ€ ๋œ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๊นŒ?

@tomlarkworthy ๋ฐ˜๋“œ์‹œ ์–ด๋ ต์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค - ์ง€๊ธˆ clientId ๊ตฌ์„ฑ์„ ํ…Œ์ŠคํŠธํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

์•„, ๋‹ค์Œ ๊ฐ’์„ ์žฌ์ •์˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

https://github.com/firebase/firebase-tools/blob/376678fef91f71de5859f14d8374b2d8d2731980/lib/api.js

์ž์ฒด oauth ํด๋ผ์ด์–ธํŠธ๋กœ ๋งž์ถค ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค๊ณ  firebase-tools client_id ๋ฐ secret_id๋ฅผ ์žฌ์ •์˜ํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿผ ํ† ํฐ์„ ๋ณต์‚ฌ ๋งน์„ธ ์›น ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์„ autheorized ๋ฐ ์ค‘ํฌ ๊ธฐ์ง€-๋„๊ตฌ๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ–ˆ๋‹ค. ์•ฝ๊ฐ„ ๋‹ค๋ฅธ ๊ฒฝ๋กœ๋กœ ์ด๋™ํ•˜์—ฌ ์„ฑ๊ณต์ ์œผ๋กœ ํ† ํฐ์„ ์ƒˆ๋กœ ๊ณ ์ณค์ง€๋งŒ ํ”„๋กœ์ ํŠธ ๋ชฉ๋ก์„ ๊ฐ€์ ธ์˜ค์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค. ํ† ํฐ ๋””์ฝ”๋”์—์„œ cloudplatformprojects ์ฝ๊ธฐ ์ „์šฉ ๋ฒ”์œ„๊ฐ€ ์žˆ์œผ๋ฏ€๋กœ ์ฝ์„ ์ˆ˜ ์žˆ์–ด์•ผ ํ•จ์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

์ •๋ณด: ํ‘œ์ค€ ์˜ค๋ฅ˜: [2018-06-07T01:02:21.126Z] ํ™˜๊ฒฝ ์žฌ์ •์˜: FIREBASE_CLIENT_ID, FIREBASE_CLIENT_SECRET
[2018-06-07T01:02:21.126Z] -------------------------------------- --------------------------------

์ •๋ณด: stderr: [2018-06-07T01:02:21.138Z] > ๋ช…๋ น์— ๋ฒ”์œ„ ํ•„์š”: ["email","openid"," https://www.googleapis.com/auth/cloudplatformprojects.readonly "," https ://www.googleapis.com/auth/firebase "," https://www.googleapis.com/auth/cloud-platform "]

์ •๋ณด: stderr: [2018-06-07T01:02:21.138Z] > --token ์˜ต์…˜์„ ํ†ตํ•œ ๊ถŒํ•œ ๋ถ€์—ฌ
[2018-06-07T01:02:21.140Z] > ๋ฒ”์œ„๊ฐ€ ์žˆ๋Š” ์•ก์„ธ์Šค ํ† ํฐ ์ƒˆ๋กœ ๊ณ ์นจ: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https:/ /www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2018-06-07T01:02:21.140Z] >>> HTTP ์š”์ฒญ ๊ฒŒ์‹œ๋ฌผ https://www.googleapis.com/oauth2/v3/token
{ ์ƒˆ๋กœ๊ณ ์นจ_ํ† ํฐ: 'ya29.XXX',
client_id: '278696186940-fbqtl733l62g4qj8aekr4i66cpo0k5c1.apps.googleusercontent.com',
client_secret: 'XXXX',
Grant_type: '์ƒˆ๋กœ๊ณ ์นจ_ํ† ํฐ',
๋ฒ”์œ„: '์ด๋ฉ”์ผ openid https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase https://www.googleapis.com/auth/cloud-platform ' }
2018๋…„ 6์›” 6์ผ ์ˆ˜์š”์ผ 18:02:21 GMT-0700(PDT)

์ •๋ณด: ํ‘œ์ค€ ์˜ค๋ฅ˜: [2018-06-07T01:02:21.318Z] <<< HTTP ์‘๋‹ต 200 x-google-netmon-label=/bns/ph/borg/ph/bns/apiserving/prod_hightraffic_api_frontend.server/998, x -google-gfe-backend-request-info=eid=HYQYW5jODYyytgbB3JfoAg, cache-control=no-cache, no-store, max-age=0, must-revalidate, pragma=no-cache, expires=Mon, 1990๋…„ 1์›” 1์ผ 00:00:00 GMT, ๋‚ ์งœ=Thu, 2018๋…„ 6์›” 7์ผ 01:02:21 GMT, vary=X-Origin, Origin, Accept-Encoding, x-google-session-info=GgIYBiAB, content-type=application/json ; charset=UTF-8, x-content-type-options=nosniff, x-frame-options=SAMEORIGIN, x-xss-protection=1; ๋ชจ๋“œ=๋ธ”๋ก, ์„œ๋ฒ„=GSE, x-google-servertype=apiserving, x-google-gfe-request-trace=acsfoh11:443,phnm21-v6:9897,/bns/ph/borg/ph/bns/apiserving/prod_hightraffic_api_frontend .server/998,phnm21-v6:9897,acsfoh11:443, x-google-gslb-service=apiserving-hightraffic, x-google-backends=plbn61:9882,/bns/ph/borg/ph/bns/apiserving/ prod_hightraffic_api_frontend.server/998,phnm21-v6:9897,/bns/ph/borg/ph/bns/traffic-prod/shared-layer2-gfe/495,acsfoh11:443, x-google-dos-service-trace= ๊ธฐ๋ณธ :identity-o-auth-2-service-migration , main:shared-layer2-gfe , x-google-service=identity-o-auth-2-service-migration,restricted-shared-layer2-grpc-aggregate, x -google-gfe-response-code-details-trace=response_code_set_by_backend,response_code_set_by_backend, x-google-gfe-response-body-transformations=gunzipped, x-google-shellfish-status=CA0gBEBG, alt-svc=quic=":443 "; ma=2592000; v="43,42,41,39,35", x-google-gfe-service-trace=identity-o-auth-2-service-migration,restricted-shared-layer2-grpc-aggregate, ํ—ˆ์šฉ ๋ฒ”์œ„= ์—†์Œ, ์—ฐ๊ฒฐ=๋‹ซ๊ธฐ

์ •๋ณด: ํ‘œ์ค€ ์˜ค๋ฅ˜: [2018-06-07T01:02:21.319Z] >>> HTTP ์š”์ฒญ GET https://admin.firebase.com/v1/projects/docsite-go

2018๋…„ 6์›” 6์ผ ์ˆ˜์š”์ผ 18:02:21 GMT-0700(PDT)

์ •๋ณด: ํ‘œ์ค€ ์˜ค๋ฅ˜: [2018-06-07T01:02:21.652Z] <<< HTTP ์‘๋‹ต 404 ์„œ๋ฒ„=nginx, ๋‚ ์งœ=Thu, 07 Jun 2018 01:02:21 GMT, content-type=application/json; charset=utf-8, ๋‚ด์šฉ ๊ธธ์ด=87, ์—ฐ๊ฒฐ=๋‹ซ๊ธฐ, x-content-type-options=nosniff

์ •๋ณด: ํ‘œ์ค€ ์˜ค๋ฅ˜: [2018-06-07T01:02:21.652Z] <<< HTTP RESPONSE BODY ์ฝ”๋“œ=PROJECT_NOT_FOUND, ๋ฉ”์‹œ์ง€=์ง€์ •ํ•œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

Firebase๋Š” ํ˜„์žฌ ๊ณ ๊ฐ ํ”„๋กœ์ ํŠธ์™€ ๋ณ„๋„๋กœ ์‚ฌ์ „ ์ •์˜๋œ ํด๋ผ์ด์–ธํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— @tomlarkworthy ์‚ฌ์šฉ์ž ์ •์˜ ๊ฐ’์œผ๋กœ client_id ๋ฐ secret์„ ์žฌ์ •์˜ํ•˜๋Š” ๊ฒƒ์€ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค(์ ์–ด๋„ ๋‚ด ์ดํ•ด).

๋˜ํ•œ --token ์˜ต์…˜์€ ์ƒˆ๋กœ ๊ณ ์นจ ํ† ํฐ๋งŒ ์ง€์›ํ•˜๋ฉฐ ์„œ๋น„์Šค ๊ณ„์ •์ด ์žˆ๋Š” ๊ฒฝ์šฐ์—๋Š” ์–ป์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค(๋‹ค์‹œ ๋งํ•˜์ง€๋งŒ ์ œ๊ฐ€ ์ดํ•ดํ•˜๋Š” ํ•œ).

๊ฐ€๋Šฅํ•œ ๊ฒฝ์šฐ ์ด ํด๋ผ์ด์–ธํŠธ ID๋กœ SA ์•ก์„ธ์Šค ํ† ํฐ์„ ์ƒ์„ฑํ•˜๋Š” ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์„ ์ฐพ์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค.

https://developers.google.com/identity/protocols/OAuth2ServiceAccount#jwt -auth์— ์„ค๋ช…๋œ ๋Œ€๋กœ ๋Œ€์ฒด ๊ฒฝ๋กœ๋กœ ์ด๋™ํ•˜์—ฌ OAuth ํ† ํฐ ๋Œ€์‹  ํด๋ผ์ด์–ธํŠธ JWT๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Firebase API๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

stephenplusplus/google-auto-auth ์—์„œ ๋‚ด๋ถ€์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” google/google-auth-library-nodejs ๋Š” ์ด๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š” ๋” ํŽธ๋ฆฌํ•˜๊ณ  ์•ˆ์ „ํ•œ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

๋‚˜๋Š” ์šฐ๋ฆฌ๊ฐ€ ๋ฐœ์ „ํ•  ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

https://github.com/firebase/firebase-tools/issues/647#issuecomment -361926336 ์ด์ „์— ์„ฑ๊ณต์„ ๋ณด๊ณ ํ•œ ๊ฒƒ์œผ๋กœ ๋ณด์ด์ง€๋งŒ ํ™•์ธ๋˜์—ˆ๋Š”์ง€ ํ™•์‹คํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋ฌธ์ œ์˜ Firebase API(https://admin.firebase.com/v1/projects)๊ฐ€ private ์ธ ๊ฒƒ์œผ๋กœ ๋ณด์ด๋ฉฐ ํ•ด๋‹น ํด๋ผ์ด์–ธํŠธ ID์— ๋Œ€ํ•ด ์ƒ์„ฑ๋œ ํ† ํฐ๋งŒ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค.

์•„๋งˆ๋„ ์ด๊ฒƒ์€ ๊ธฐ๋Šฅ ์š”์ฒญ์œผ๋กœ ์ œ์ถœํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋ฐฐํฌ์— ์„œ๋น„์Šค ๊ณ„์ •์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์ด ์žˆ์œผ๋ฉด ๋‹จ์ผ ์ž๊ฒฉ ์ฆ๋ช…์„ ์‚ฌ์šฉํ•˜์—ฌ(๋ชจ๋“  ์‚ฌ์šฉ์ž๋กœ๋ถ€ํ„ฐ ๋ถ„๋ฆฌ๋จ) Firebase์™€ GCP ๋ฆฌ์†Œ์Šค๋ฅผ ๋ชจ๋‘ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

CLI์˜ --token ์˜ต์…˜์€ ์•ก์„ธ์Šค ํ† ํฐ์ด ์•„๋‹ˆ๋ผ ์ƒˆ๋กœ ๊ณ ์นจ ํ† ํฐ์„ ์ „๋‹ฌํ•˜๊ธฐ ์œ„ํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. firebase login:ci ์—์„œ ์ƒ์„ฑ๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์„œ๋น„์Šค ๊ณ„์ • ์Šน์ธ์„ ๊ด‘๋ฒ”์œ„ํ•˜๊ฒŒ ํ…Œ์ŠคํŠธํ•˜์ง€๋Š” ์•Š์•˜์ง€๋งŒ admin.firebase.com ๋ฐฑ์—”๋“œ์—์„œ ๊ด‘๋ฒ”์œ„ํ•œ ๊ถŒํ•œ์ด ํ•„์š”ํ•œ IAM ๊ฒ€์‚ฌ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ๋” ์ž์„ธํžˆ ์กฐ์‚ฌํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ์—ฌ๊ธฐ์—์„œ ๋ฐ˜๋“œ์‹œ ์ดˆ๊ณ ์† ํ•ด๊ฒฐ์„ ๊ธฐ๋Œ€ํ•˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค.

CLI์˜ --token ์˜ต์…˜์€ ์ƒˆ๋กœ ๊ณ ์นจ ํ† ํฐ์„ ์ „๋‹ฌํ•˜๊ธฐ ์œ„ํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๋„ค, ์œ„์™€ ๊ฐ™์ด ์ดํ•ดํ•ฉ๋‹ˆ๋‹ค.

SA ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ CI ํ™˜๊ฒฝ์—์„œ ๋ฐฐํฌํ•˜๋Š” ๊ฒƒ์€ ๋†€๋ผ์šด ์ผ์ž…๋‹ˆ๋‹ค. ์ƒˆ๋กœ ๊ณ ์นจ ํ† ํฐ์€ ํŠน์ • ์‚ฌ์šฉ์ž์—๊ฒŒ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ์œผ๋ฉฐ ๋‹ค๋ฅธ GCP ์„œ๋น„์Šค๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด gcloud ๋ช…๋ น์„ ์ธ์ฆํ•˜๋Š” ๋ฐ ์ด ํ† ํฐ์„ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๋ช…ํ™•ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ˜„์žฌ ๋‘ ๊ฐ€์ง€ ์œ ํ˜•์˜ ์ž๊ฒฉ ์ฆ๋ช…(Firebase CLI์šฉ ๊ด€๋ฆฌ์ž ์ƒˆ๋กœ ๊ณ ์นจ ํ† ํฐ ๋ฐ gcloud ์šฉ SA ํ‚ค)์„ ์ œ๊ณตํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์„œ๋น„์Šค ๊ณ„์ •์— ๋Œ€ํ•ด ์ƒ์„ฑ๋œ ํ† ํฐ์„ ์‚ฌ์šฉํ•˜์—ฌ FIREBASE_TOKEN='<token_here>' firebase deploy --only firestore,storage (๋‹ค๋ฅธ ๋Œ€์ƒ์„ ์‹œ๋„ํ•˜์ง€ ์•Š์•˜์œผ๋ฉฐ ์ž‘๋™ํ•  ์ˆ˜ ์žˆ์Œ)ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์‹ค์ œ ํ† ํฐ์€ " https://www.googleapis.com/auth/cloud-platform " ๋ฒ”์œ„ ์˜ ๋ณผํŠธ์˜ GCP ๋น„๋ฐ€ ์—”์ง„์— ์˜ํ•ด ์„œ๋น„์Šค ๊ณ„์ •์— ๋Œ€ํ•ด ์ƒ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ตœ์‹  Firebase CLI์™€ ํ•จ๊ป˜ SA ํ‚ค + GOOGLE_APPLICATION_CREDENTIALS๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋ถˆ๊ฐ€๋Šฅํ•จ์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ๋ช…๋ น์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ข…๋ฃŒ๋ฉ๋‹ˆ๋‹ค.

root<strong i="6">@frontend</strong>:/usr/src/app$ firebase list

Error: HTTP Error: 404, The specified project was not found.

Having trouble? Try firebase list --help

@cpic ํฅ๋ฏธ

@paolomainardi firebase list ๋Š” ๋ ˆ๊ฑฐ์‹œ ํ”„๋กœ์ ํŠธ ๋ชฉ๋ก ๊ตฌํ˜„์— ์˜์กดํ•˜๊ธฐ ๋•Œ๋ฌธ์— SA ํ‚ค๋กœ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋‹ค๋ฅธ ๋ชจ๋“  ๊ฒƒ์€ ๊ทธ๋ ‡๊ฒŒ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค(๋จผ์ € ๋ช‡ ๊ฐ€์ง€ API๋ฅผ ํ™œ์„ฑํ™”ํ•ด์•ผ ํ•  ์ˆ˜๋„ ์žˆ์Œ). ๋‹ค๋ฅธ ๋ช…๋ น์„ ์‹œ๋„ํ•˜๊ณ  ํ™•์ธํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

์šฐ๋ฆฌ๋Š” GOOGLE_APPLICATION_CREDENTIALS ๋ช‡ ๊ฐ€์ง€ ํ›Œ๋ฅญํ•œ ์‚ฌ์šฉ ์‚ฌ๋ก€๋ฅผ ์ œ๊ณตํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋งŽ์€ ์–ด๋ ค์›€์„ ๊ฒช์ง€ ์•Š๊ณ  ์™„์ „ํ•œ ์ง€์›์„ ์–ป๊ธฐ ์œ„ํ•ด ๋…ธ๋ ฅํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

@paolomainardi vault ๊ตฌํ˜„์ด ์—ฌ๊ธฐ์— ์žˆ๋‹ค๊ณ  ์ƒ๊ฐ ํ•ฉ๋‹ˆ๋‹ค(์ฝ”๋“œ๋ฅผ ๋น ๋ฅด๊ฒŒ ๊ฒ€์ƒ‰ํ•œ ํ›„์˜ ์ถ”์ธก์ผ ๋ฟ์ž…๋‹ˆ๋‹ค).

๋‚˜๋Š” ๋˜ํ•œ ๊ทธ๊ฒƒ์ด gcloud alpha iam service-accounts sign-jwt ๊ฐ€ ํ•˜๋Š” ๊ฒƒ๊ณผ ๊ฐ™์€ ๊ฒƒ์ด๋ผ๊ณ  ์ƒ๊ฐ ํ•ฉ๋‹ˆ๋‹ค(๋‹ค์‹œ ๋งํ•˜์ง€๋งŒ, ๋‹ค์†Œ ๊ต์œก๋ฐ›์€ ์ถ”์ธก).

@cpick์— ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค. ๊ณ„์†ํ•ด์„œ ์†Œ์‹์„ ์ „ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

๋‚˜๋Š” ์ด๊ฒƒ์„ ๊ฐ„๋‹จํžˆ ์‚ดํŽด๋ณด๊ณ  ํ…Œ์ŠคํŠธ๋กœ ์„œ๋น„์Šค ๊ณ„์ • ์ž๊ฒฉ ์ฆ๋ช…๊ณผ access_token ๋ฅผ requireAuth.js ์— ๊ฐ•์ œ๋กœ ๋„ฃ์œผ๋ ค๊ณ  ํ–ˆ์Šต๋‹ˆ๋‹ค.
์ ์–ด๋„ ๋ฌด์–ธ๊ฐ€๊ฐ€ ์ž‘๋™ํ•˜๋Š” ๊ฒƒ์„ ๋ณด๋ ค๊ณ  ์‹œ๋„ํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๊ฒƒ์€ ์ ‘์ด‰์— CLI๋Š” ํ•ญ์ƒ ์‹œ๋„๋ฅผ ๋ณด์ธ๋‹ค https://admin.firebase.com/v1/projects/ (๋‹น์‹ ์€ ๋‚ด๊ฐ€ w /๋ฅผ ๋ฌด์—‡์„ ์˜๋ฏธ ํ•  ์ˆ˜์žˆ๋‹ค ์ƒ๊ด€์—†์ด --debug ํ”Œ๋ž˜๊ทธ. ๋‚ด๊ฐ€์ด ๋ฌธ์ œ์— ์ด์ „ ์ฝ”๋ฉ˜ํŠธ๋กœ ์ฝ๋Š”๋‹ค๋ฉด, ๊ทธ๊ฒƒ์€ ์•„๋งˆ๋„ '์œ ์‚ฐ์„ svc ๊ณ„์ •์—์„œ ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ' api ๋์ '.

๊ฐ„๋‹จํ•œ GET ํ˜ธ์ถœ๋กœ ๋‹ค๋ฅธ ๋์ ์„ ํ…Œ์ŠคํŠธํ–ˆ๋Š”๋ฐ ๊ดœ์ฐฎ์€ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์‹ฌํŒ์„ ์œ„ํ•ด


  • ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด requireAuth.js ๋ฅผ ํ•˜๋“œ์ฝ”๋”ฉํ•œ ์ˆ˜์ •์€ ๋„“์€ ๋ฒ”์œ„์˜ svc_accounts ์•ก์„ธ์Šค ํ† ํฐ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
function getServiceAccountClient() {
  const credFile = '/path/to/cert.json';
  const keys = require(credFile);
  let client = new JWT(
    keys.client_email,
    null,
    keys.private_key,
    ["email","openid","https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"],
  );
  return client;
};

function _autoAuth(options, authScopes) {
  return new Promise(function(resolve, reject) {
    var client = getServiceAccountClient();
    client.getAccessToken().then(res => {
      console.log(res);
     api.setAccessToken(res.token);
     resolve();

    }).catch(function (error) {
      console.error('Unable to recall targetClient access_token ' + error);
    });    

    /*
        logger.debug("> attempting to authenticate via app default credentials");
 ......

  • ์ผ๋ฐ˜ ํด๋ผ์ด์–ธํŠธ
const {JWT} = require('google-auth-library');

function getServiceAccountClient() {
    const credFile = '/path/to/cert.json';
    const keys = require(credFile);

    let client = new JWT(
      keys.client_email,
      null,
      keys.private_key,
      ["email","openid","https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"],
    );
    return client;
  };

  var client = getServiceAccountClient();
    let project_id = 'your_project';
    let url = 'https://admin.firebase.com/v1/projects/' + project_id
    //let url = "https://firestore.googleapis.com/v1beta1/projects/" + project_id + "/databases/(default)/indexes"
    //let url = "https://firebaserules.googleapis.com/v1/projects/" + project_id  + "/rulesets" 

    client.requestAsync({url}).then(resp => {
      console.log(resp.data);
    }).catch(function (error) {
      console.error('Unable to list buckets: ' + error);
    }); 

์ด ์š”์ง€ ์— ํ‘œ์‹œ๋œ ๋Œ€๋กœ firestore , storage ๋ฐ hosting ์„œ๋น„์Šค ๊ณ„์ •์„ ์‚ฌ์šฉํ•˜์—ฌ ๋งˆ์นจ๋‚ด ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์ด๋ฏธ ์žˆ๋˜ ADC..>

๋‹ค์Œ์€ functions ๋ฐฐํฌ์—์„œ ์ž‘๋™ํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ๊ธฐ๋ณธ์ ์œผ๋กœ ํ•ดํ‚น์ด๋ฉฐ ๋ถˆ์™„์ „ํ•ฉ๋‹ˆ๋‹ค. ์œ„์˜ mbleigh๊ฐ€ '์ผ๊ธ‰ ์ง€์›'์— ๋Œ€ํ•ด ์–ธ๊ธ‰ํ•œ ์ „์ฒด ์†”๋ฃจ์…˜์€ ๊ธฐ๋‹ค๋ฆด ๊ฐ€์น˜๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.


์–ด์จŒ๋“  ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

gcloud ์ปจํ…์ŠคํŠธ์—์„œ๋„ Firebase ๊ณ„์ •์œผ๋กœ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

  1. ์„œ๋น„์Šค ๊ณ„์ • ๊ฐœ์ธ ํ‚ค ๊ฐ€์ ธ์˜ค๊ธฐ
$ gcloud iam service-accounts list
NAME                                EMAIL
App Engine default service account  [email protected]
firebase-adminsdk                   firebase-adminsdk-h2v8k@firebase-auth-sal.iam.gserviceaccount.com

gcloud iam service-accounts keys  create `pwd`/svc.json --iam-account=firebase-adminsdk-h2v8k@firebase-auth-sal.iam.gserviceaccount.com
  1. ํ•ด๋‹น ํ”„๋กœ์ ํŠธ์—์„œ ์„œ๋น„์Šค ๊ณ„์ •์„ OWNER ๋กœ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

    • ํ”„๋กœ์ ํŠธ ์†Œ์œ ์ž๋กœ firebase-adminsdk-h2v8k@firebase-auth-sal.iam.gserviceaccount.com ์ถ”๊ฐ€
      (๋‚ฎ์€ ๊ถŒํ•œ ์ง‘ํ•ฉ์œผ๋กœ๋„ ์ถฉ๋ถ„ํ•˜๋‹ค๊ณ  ํ™•์‹ ํ•˜์ง€๋งŒ ์ž์„ธํžˆ๋Š” ๋ณด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  2. ํด๋ผ์šฐ๋“œ ์ฝ˜์†”๋กœ ์ด๋™ํ•˜์—ฌ ์ผ๋ถ€ API๋ฅผ ํ™œ์„ฑํ™”ํ•ฉ๋‹ˆ๋‹ค.

https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=<your_project>

https://console.developers.google.com/apis/api/firebasehosting.googleapis.com/overview?project=<your_project>
  1. ๋กœ์ปฌ ์ž๊ฒฉ ์ฆ๋ช… ์ œ๊ฑฐ

gcloud ๋ฐ firebase

$ firebase logout
โœ”  Logged out from [email protected]

$ mv ~/.config/gcloud ~/.config/gcloud_backup
  1. ADC env-var ์„ค์ • ๋ฐ ๋ฐฐํฌ
export GOOGLE_APPLICATION_CREDENTIALS=`pwd`/svc.json

$ firebase deploy -P firebase-auth-sal --only firestore,hosting,storage 
{ token: 'ya29.c.EmJ8B....',  res: null }

=== Deploying to 'firebase-auth-sal'...

i  deploying storage, firestore, hosting
i  storage: checking storage.rules for compilation errors...
โœ”  storage: rules file storage.rules compiled successfully
i  firestore: checking firestore.rules for compilation errors...
i  firestore: reading indexes from firestore.indexes.json...
โœ”  firestore: rules file firestore.rules compiled successfully
i  storage: uploading rules storage.rules...
i  firestore: uploading rules firestore.rules...
โœ”  firestore: deployed indexes in firestore.indexes.json successfully
i  hosting[fir-auth-sal]: beginning deploy...
i  hosting[fir-auth-sal]: found 1 files in public
โœ”  hosting[fir-auth-sal]: file upload complete
โœ”  storage: released rules storage.rules to firebase.storage/firebase-auth-sal.appspot.com
โœ”  firestore: released rules firestore.rules to cloud.firestore
i  hosting[fir-auth-sal]: finalizing version...
โœ”  hosting[fir-auth-sal]: version finalized
i  hosting[fir-auth-sal]: releasing new version...
โœ”  hosting[fir-auth-sal]: release complete

โœ”  Deploy complete!

Project Console: https://console.firebase.google.com/project/firebase-auth-sal/overview
Hosting URL: https://fir-auth-sal.firebaseapp.com
  1. ๋ฐฐํฌ ํ™•์ธ

deployment_hosting

  1. functions ๋ฐฐํฌ ์‹œ๋„

functions ๋ฐฐํฌ ์œ ํ˜•์€ ์•„๋ž˜ ํ™œ์„ฑํ™” ๊ฒ€์‚ฌ๋ฅผ ์žฌ์ •์˜ํ•˜๋ ค๊ณ  ํ•ด๋„ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค(๋‹ค๋ฅธ mobilesdk.googleapis.com ์—”๋“œํฌ์ธํŠธ์— ์•ก์„ธ์Šคํ•˜๋ฉด ์ค‘์ง€๋ฉ๋‹ˆ๋‹ค. Firebase ๊ธฐ๋Šฅ ๋ฐฐํฌ๊ฐ€ client_id ์—ฐ๊ฒฐ๋˜์–ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Firebase ๊ธฐ๋Šฅ์˜ ๊ฒฝ์šฐ

$ firebase deploy -P firebase-auth-sal --only functions --debug

[2018-12-24T01:36:44.034Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/cloudfunctions.googleapis.com/projectSettings/firebase-auth-sal?view=CONSUMER_VIEW  

[2018-12-24T01:36:44.034Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/firebase-auth-sal?view=CONSUMER_VIEW  

[2018-12-24T01:36:44.486Z] <<< HTTP RESPONSE 404 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Mon, 24 Dec 2018 01:36:44 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
[2018-12-24T01:36:44.486Z] <<< HTTP RESPONSE BODY code=404, message=Method not found., status=NOT_FOUND

Error: HTTP Error: 404, Method not found.
[2018-12-24T01:36:44.495Z] Error Context: {
  "body": {
    "error": {
      "code": 404,
      "message": "Method not found.",
      "status": "NOT_FOUND"

๋‚ด๋ถ€ ๋ฒ„๊ทธ ์ฐธ์กฐ: 122552119

@tinaliang ์ด ๋ฌธ์ œ์— ๋Œ€ํ•œ ์—…๋ฐ์ดํŠธ๊ฐ€ ์žˆ์Šต๋‹ˆ๊นŒ? ์ธ์ฆ์„ ์œ„ํ•œ ์„œ๋น„์Šค ๊ณ„์ • ์ง€์›์ด ์šฐ์„ ๋˜์–ด์•ผ ํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ์—…๋ฐ์ดํŠธ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค...

์ง€๋‚œ ๋‚ ์˜ ๋‚ด ๋ฐœ๊ฒฌ์€ ํŠน๋ณ„ํžˆ Firebase ํด๋ผ์šฐ๋“œ ๊ธฐ๋Šฅ์ด ํ•„์š”ํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์˜ˆ์ƒ๋Œ€๋กœ ์ž‘๋™ํ•˜๋Š” GCP ํด๋ผ์šฐ๋“œ ๊ธฐ๋Šฅ https://cloud.google.com/functions/ ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค(๋ฐฐํฌ๋Š” gcloud CLI๋ฅผ ํ†ตํ•ด ์ˆ˜ํ–‰๋จ) ๊ทธ๋Ÿฌ๋‚˜ ์ด๊ฒƒ์€ ์‹ค์ œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ ์•„๋‹ˆ์ง€๋งŒ ... ๋ˆ„๊ตฐ๊ฐ€์—๊ฒŒ ๋„์›€์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. :)

#1175์— ์˜ํ•ด ๋ณต์ œ๋จ

์•„์ง ์—…๋ฐ์ดํŠธ๊ฐ€ ์žˆ์Šต๋‹ˆ๊นŒ? Cloud Build๋ฅผ ํ†ตํ•ด Firebase ์•ฑ์„ ๋ฐฐํฌํ•˜๋ ค๊ณ  ํ–ˆ์Šต๋‹ˆ๋‹ค. hosting ๋“ฑ์ด ์ œ๋Œ€๋กœ ์ž‘๋™ํ•˜๊ณ  ๋ฐฐํฌ๋˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. functions ๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๋ฐฐํฌ๋˜์ง€ ์•Š๊ณ  ์œ„์—์„œ ์„ค๋ช…ํ•œ ๋Œ€๋กœ IAM ๋‚ด์—์„œ ์ ์ ˆํ•œ ๊ตฌ์„ฑ์œผ๋กœ 404 ๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. (์„œ๋น„์Šค ๊ณ„์ • cloudbuild ์—๋Š” "Firebase Admin" ๋ฐ "API Keys Admin"์— ๋Œ€ํ•œ ๊ถŒํ•œ์ด ์žˆ์Šต๋‹ˆ๋‹ค.) ์ด ํ‹ฐ์ผ“์€ ์šฐ์„  ์ˆœ์œ„๊ฐ€ ๋†’์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค ๐Ÿ”ฅ

์•„์ง ์—…๋ฐ์ดํŠธ๊ฐ€ ์—†์ง€๋งŒ ๊ณง ์‚ดํŽด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

@mbleigh ์–ด๋–ค ์—…๋ฐ์ดํŠธ? ํ˜„์žฌ Firebase CLI์—์„œ ์„œ๋น„์Šค ๊ณ„์ •์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐฐํฌํ•  ์ˆ˜ ์—†์Œ์„ ํ™•์ธํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ? ์šฐ๋ฆฌ๋Š” CI ๋„๊ตฌ๋ฅผ ์›ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ GOOGLE_APPLICATION_CREDENTIALS ์ง€์›์ด ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๊นŒ?

์ด์ „์— ์–ธ๊ธ‰ํ–ˆ๋“ฏ์ด ๋ชจ๋“  firebase CLI ๋ช…๋ น์ด GOOGLE_APPLICATION_CREDENTIALS ์—์„œ ์ž‘๋™ํ•˜๋Š” ๊ฒƒ์€ ์•„๋‹ˆ์ง€๋งŒ ์ข‹์€ ์ˆซ์ž๋Š” ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์„œ๋น„์Šค ๊ณ„์ • ์ž๊ฒฉ ์ฆ๋ช…์˜ ๊ฒฝ๋กœ๋กœ ์„ค์ •ํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค(์‚ฌ์‹ค, ๋ฌด์—‡๋ณด๋‹ค๋„ test-hosting.sh ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ํ•˜๋Š” ์ผ์ž…๋‹ˆ๋‹ค).

firebase login:ci ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด CI ์‹œ์Šคํ…œ์—์„œ ํ† ํฐ ์„ ํ•ฉ๋‹ˆ๋‹ค.

GOOGLE_APPLICATION_CREDENTIALS ์˜ ์‚ฌ์šฉ๋ฒ•๊ณผ ๊ธฐ๋Šฅ์„ ๊ณต์‹ํ™”ํ•˜๋Š” ๊ฒƒ์€ ์šฐ๋ฆฌ์˜ ๋งˆ์Œ์— ์žˆ์ง€๋งŒ ์ผ์ •์„ ์•ฝ์†ํ•  ์ˆ˜๋Š” ์—†์Šต๋‹ˆ๋‹ค. ๊ธฐ๋‹ค๋ ค ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

์ด ๊ฒฝ์šฐ ์ธ์Šคํ„ด์Šค ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ADC๊ฐ€ ์ž‘๋™ํ•˜๋Š”์ง€ ์•„๋‹ˆ๋ฉด GOOGLE_APPLICATION_CREDENTIALS ๋งŒ ์ž‘๋™ํ•˜๋Š”์ง€ ๋ช…ํ™•ํžˆ ํ•ด์ฃผ์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

์ด ์Šค๋ ˆ๋“œ์— ์žˆ๋Š” ๋ชจ๋“  ์‚ฌ์šฉ์ž: ๋ชจํ—˜์‹ฌ์„ ๋Š๋ผ๊ณ  ์žˆ๋‹ค๋ฉด #1463์˜ ๋ถ„๊ธฐ๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด๊ณ  ์„œ๋น„์Šค ๊ณ„์ • ์ธ์ฆ์œผ๋กœ ์›ํ•˜๋Š” ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๊ฐ€ ๋Œ€๋ถ€๋ถ„์˜ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์ง€๋งŒ ๊ทธ๋Ÿฌํ•œ ๋ฌธ์ œ์— ๋Œ€ํ•œ ์™ธ๋ถ€ ํ…Œ์ŠคํŠธ๋ฅผ ๋ฐ›๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.

@mbleigh firebase apps:list web ๋Š” Cloud Build์˜ ์ ˆ๋ฐ˜์— ๊ฐ„ํ—์ ์œผ๋กœ ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค. ๋””๋ฒ„๊ทธ๋กœ ์‹คํ–‰ํ•˜๋ฉด ์‹คํŒจ ์ด์œ ์— ๋Œ€ํ•œ ์ •๋ณด๊ฐ€ ์ œ๊ณต๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋ฌด์Šจ ์ผ์ด ์ผ์–ด๋‚  ์ˆ˜ ์žˆ๋Š”์ง€์— ๋Œ€ํ•œ ์–ด๋–ค ์ƒ๊ฐ์ด ์žˆ์Šต๋‹ˆ๊นŒ?

[2020-02-13T21:25:55.987Z] ----------------------------------------------------------------------
[2020-02-13T21:25:55.991Z] Command:       /usr/local/bin/node /workspace/node_modules/.bin/firebase apps:list web -j --project=projectName --debug
[2020-02-13T21:25:55.991Z] CLI Version:   7.12.1
[2020-02-13T21:25:55.991Z] Platform:      linux
[2020-02-13T21:25:55.991Z] Node Version:  v10.18.0
[2020-02-13T21:25:55.992Z] Time:          Thu Feb 13 2020 21:25:55 GMT+0000 (Coordinated Universal Time)
[2020-02-13T21:25:55.992Z] ----------------------------------------------------------------------

๋˜ํ•œ @mbleigh firebase use projectName ๋ช…๋ น๋„ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ์„œ๋ฒ„์—์„œ ์˜ฌ๋ฐ”๋ฅธ ์ž๊ฒฉ ์ฆ๋ช…์„ ๊ฐ€์ ธ ์˜ค์ง€ ๋ชปํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ„ํ—์ ์œผ๋กœ ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค.

[2020-02-13T21:49:41.050Z] ----------------------------------------------------------------------
[2020-02-13T21:49:41.055Z] Command:       /usr/bin/node /directory/node_modules/.bin/firebase --debug use projectName
[2020-02-13T21:49:41.056Z] CLI Version:   7.12.1
[2020-02-13T21:49:41.056Z] Platform:      linux
[2020-02-13T21:49:41.056Z] Node Version:  v10.16.3
[2020-02-13T21:49:41.056Z] Time:          Thu Feb 13 2020 21:49:41 GMT+0000 (Coordinated Universal Time)
[2020-02-13T21:49:41.056Z] ----------------------------------------------------------------------
[2020-02-13T21:49:41.057Z] 
[2020-02-13T21:49:41.073Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-02-13T21:49:41.073Z] > attempting to authenticate via app default credentials
[2020-02-13T21:49:41.669Z] TypeError: Cannot create property 'refresh_token' on string 'Not Found
'
    at /directory/node_modules/google-auto-auth/node_modules/google-auth-library/lib/auth/oauth2client.js:208:28
    at /directory/node_modules/google-auto-auth/node_modules/google-auth-library/lib/auth/computeclient.js:85:7
    at Request._callback (/directory/node_modules/google-auto-auth/node_modules/google-auth-library/lib/transporters.js:106:7)
    at Request.self.callback (/directory/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.EventEmitter.emit (domain.js:448:20)
    at Request.<anonymous> (/directory/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:198:13)
    at Request.EventEmitter.emit (domain.js:448:20)
    at IncomingMessage.<anonymous> (/directory/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
    at IncomingMessage.EventEmitter.emit (domain.js:448:20)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

10/02/20๋ถ€ํ„ฐ ์„œ๋น„์Šค ๊ณ„์ •์„ ์‚ฌ์šฉํ•  ๋•Œ Cloudbuild๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Firebase ํ˜ธ์ŠคํŒ…์— ๋ฐฐํฌํ•  ๋•Œ ๊ฐ„ํ—์ ์ธ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๊ธฐ ์‹œ์ž‘ํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ „์—๋Š” ํ•œ๋™์•ˆ ์ผ๊ด€๋˜๊ฒŒ ๊ดœ์ฐฎ์•˜๊ณ  ์ด์ œ๋Š” ์ž์ฃผ ์‹คํŒจํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ด ์ž‘์—…์„ ์„ฑ๊ณต์ ์œผ๋กœ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ์„œ๋น„์Šค ๊ณ„์ •์— ์œ„์ž„ํ•ด์•ผ ํ•˜๋Š” ์ƒˆ๋กœ์šด ๊ถŒํ•œ ์ง‘ํ•ฉ์ด ์žˆ๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค. ๋‚ด ๋ฐฐํฌ์˜ ๋Œ€๋ถ€๋ถ„์ด ๋‹จ์ˆœํžˆ ์‹คํŒจํ•˜๋Š” ๊ฒƒ์€ ์•ฝ๊ฐ„์˜ ๋ฌธ์ œ๊ฐ€ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค ๐Ÿ˜ž

๋‹ค์Œ์€ ๋นŒ๋“œ์˜ ์˜ˆ์™€ ๊ฐ‘์ž๊ธฐ ์‹คํŒจํ•˜๊ธฐ ์‹œ์ž‘ํ–ˆ์„ ๋•Œ์˜ ์Šคํฌ๋ฆฐ์ƒท์ž…๋‹ˆ๋‹ค.

image

๋””๋ฒ„๊ทธ ์˜ค๋ฅ˜๋Š” ์œ„์˜ ์ฃผ์„๊ณผ ๋งค์šฐ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

[2020-02-16T07:30:46.905Z] ----------------------------------------------------------------------
[2020-02-16T07:30:46.908Z] Command:       /usr/local/bin/node /home/node/.npm-global/bin/firebase deploy --only hosting -P project-production --debug
[2020-02-16T07:30:46.908Z] CLI Version:   7.8.1
[2020-02-16T07:30:46.908Z] Platform:      linux
[2020-02-16T07:30:46.909Z] Node Version:  v12.13.1
[2020-02-16T07:30:46.909Z] Time:          Sun Feb 16 2020 07:30:46 GMT+0000 (Coordinated Universal Time)
[2020-02-16T07:30:46.910Z] ----------------------------------------------------------------------
[2020-02-16T07:30:46.910Z] 
[2020-02-16T07:30:46.920Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-02-16T07:30:46.920Z] > attempting to authenticate via app default credentials
[2020-02-16T07:30:47.023Z] TypeError: Cannot create property 'refresh_token' on string 'Not Found
'
    at /home/node/.npm-global/lib/node_modules/firebase-tools/node_modules/google-auto-auth/node_modules/google-auth-library/lib/auth/oauth2client.js:208:28
    at /home/node/.npm-global/lib/node_modules/firebase-tools/node_modules/google-auto-auth/node_modules/google-auth-library/lib/auth/computeclient.js:85:7
    at Request._callback (/home/node/.npm-global/lib/node_modules/firebase-tools/node_modules/google-auto-auth/node_modules/google-auth-library/lib/transporters.js:106:7)
    at Request.self.callback (/home/node/.npm-global/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
    at Request.emit (events.js:210:5)
    at Request.EventEmitter.emit (domain.js:475:20)
    at Request.<anonymous> (/home/node/.npm-global/lib/node_modules/firebase-tools/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:210:5)
    at Request.EventEmitter.emit (domain.js:475:20)
    at IncomingMessage.<anonymous> (/home/node/.npm-global/lib/node_modules/firebase-tools/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:299:28)
    at IncomingMessage.emit (events.js:215:7)
    at IncomingMessage.EventEmitter.emit (domain.js:475:20)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

Error: An unexpected error has occurred.

์ด๊ฒƒ์€ https://github.com/firebase/firebase-tools/issues/1970 (์ฆ‰, ์ด์ „ gcloud Auth์—์„œ ์—ฌ์ „ํžˆ ์‚ฌ์šฉ๋˜๋Š” ์ด์ „ v1beta1 ์ธ์Šคํ„ด์Šค ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ์—”๋“œํฌ์ธํŠธ์˜ ์ง€์› ์ค‘๋‹จ)๊ณผ ๊ด€๋ จ์ด ์žˆ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. Firebase CLI์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ..)

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰