File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 13
13
* See the License for the specific language governing permissions and
14
14
* limitations under the License.
15
15
*/
16
-
16
+ 'use strict' ;
17
17
// [START get_service_account_tokens]
18
- var admin = require ( " firebase-admin" ) ;
18
+ const admin = require ( ' firebase-admin' ) ;
19
19
20
- var serviceAccount = require ( " path/to/serviceAccountKey.json" ) ;
21
- var credential = admin . credential . cert ( serviceAccount ) ;
20
+ const serviceAccount = require ( ' path/to/serviceAccountKey.json' ) ;
21
+ const credential = admin . credential . cert ( serviceAccount ) ;
22
22
23
- credential . getAccessToken ( ) . then ( function ( accessTokenInfo ) {
24
- var accessToken = accessTokenInfo . access_token ;
25
- var expirationTime = accessTokenInfo . expires_in ;
23
+ credential . getAccessToken ( ) . then ( ( accessTokenInfo ) => {
24
+ const accessToken = accessTokenInfo . access_token ;
25
+ const expirationTime = accessTokenInfo . expires_in ;
26
26
27
27
// Attach accessToken to HTTPS request in the "Authorization: Bearer" header
28
28
// After expirationTime, you must generate a new access token
29
29
// [START_EXCLUDE]
30
- console . log ( " The token " + accessToken + " expires in " + expirationTime ) ;
30
+ console . log ( ` The token ${ accessToken } expires in ${ expirationTime } ` ) ;
31
31
// [END_EXCLUDE]
32
32
} ) ;
33
33
// [END get_service_account_tokens]
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " snippets-node" ,
2
+ "name" : " snippets-node-auth " ,
3
3
"version" : " 1.0.0" ,
4
4
"description" : " Code snippets used in Node.js documentation on firebase.google.com" ,
5
5
"author" : " Firebase (https://firebase.google.com/)" ,
You can’t perform that action at this time.
0 commit comments