File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ const admin = require ( 'firebase-admin' ) ;
3
+
1
4
// Initialize the Admin app with the default appication credentials
2
5
// [START initialize_sdk_with_default_config]
3
6
admin . initializeApp ( ) ;
@@ -11,28 +14,28 @@ admin.initializeApp({
11
14
// [END initialize_sdk_with_service_account_id]
12
15
13
16
// [START custom_token]
14
- var uid = " some-uid" ;
17
+ var uid = ' some-uid' ;
15
18
16
19
admin . auth ( ) . createCustomToken ( uid )
17
20
. then ( function ( customToken ) {
18
21
// Send token back to client
19
22
} )
20
23
. catch ( function ( error ) {
21
- console . log ( " Error creating custom token:" , error ) ;
24
+ console . log ( ' Error creating custom token:' , error ) ;
22
25
} ) ;
23
26
// [END custom_token]
24
27
25
28
// [START custom_token_with_claims]
26
- var uid = " some-uid" ;
29
+ var userId = ' some-uid' ;
27
30
var additionalClaims = {
28
31
premiumAccount : true
29
32
} ;
30
33
31
- admin . auth ( ) . createCustomToken ( uid , additionalClaims )
34
+ admin . auth ( ) . createCustomToken ( userId , additionalClaims )
32
35
. then ( function ( customToken ) {
33
36
// Send token back to client
34
37
} )
35
38
. catch ( function ( error ) {
36
- console . log ( " Error creating custom token:" , error ) ;
39
+ console . log ( ' Error creating custom token:' , error ) ;
37
40
} ) ;
38
41
// [END custom_token_with_claims]
You can’t perform that action at this time.
0 commit comments