File tree Expand file tree Collapse file tree 3 files changed +21
-9
lines changed Expand file tree Collapse file tree 3 files changed +21
-9
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
3
3
__title__ = 'djangorestframework-firebase-auth'
4
- __version__ = '0.1.3 '
4
+ __version__ = '0.1.4 '
5
5
__author__ = 'Wesley Lima'
6
6
__license__ = 'MIT'
7
7
__copyright__ = 'Copyright 2018 Fan Retreat, Inc.'
Original file line number Diff line number Diff line change 12
12
BaseAuthentication , get_authorization_header
13
13
)
14
14
15
- # TODO: Support entering the keys individually later
16
- cred = credentials .Certificate (api_settings .FIREBASE_ACCOUNT_KEY_FILE )
17
- firebase = firebase_admin .initialize_app (cred )
15
+ if api_settings .FIREBASE_ACCOUNT_KEY_FILE :
16
+ creds = credentials .Certificate (api_settings .FIREBASE_ACCOUNT_KEY_FILE )
17
+ else :
18
+ creds = credentials .Certificate (api_settings .FIREBASE_CREDENTIALS )
19
+
20
+ firebase = firebase_admin .initialize_app (creds )
21
+
18
22
19
23
class BaseFirebaseAuthentication (BaseAuthentication ):
20
24
"""
Original file line number Diff line number Diff line change 8
8
9
9
DEFAULTS = {
10
10
'FIREBASE_ACCOUNT_KEY_FILE' : '' , # JSON formatted key file you get directly from firebase
11
-
12
- # The credentials if you want to enter them in manually (not implemented)
13
- 'FIREBASE_PRIVATE_KEY' : None ,
14
- 'FIREBASE_PUBLIC_KEY' : None ,
15
- 'FIREBASE_CLIENT_EMAIL' : None ,
11
+ 'FIREBASE_CREDENTIALS' : {
12
+ 'type' : "service_account" ,
13
+ 'project_id' : "" ,
14
+ 'private_key_id' : "" ,
15
+ 'private_key' : "" ,
16
+ 'client_email' : "" ,
17
+ 'client_id' : "" ,
18
+ 'auth_uri' : "https://accounts.google.com/o/oauth2/auth" ,
19
+ 'token_uri' : "https://accounts.google.com/o/oauth2/token" ,
20
+ 'auth_provider_x509_cert_url' : "https://www.googleapis.com/oauth2/v1/certs" ,
21
+ 'client_x509_cert_url' : ""
22
+ }, # the credentials in raw json form
23
+
16
24
'FIREBASE_CREATE_NEW_USER' : True , # We'll make a new user if we get one that we don't have yet
17
25
18
26
'FIREBASE_AUTH_HEADER_PREFIX' : "JWT" ,
You can’t perform that action at this time.
0 commit comments