Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to setup firebase config json #5

Open
mreguly opened this issue Jan 9, 2019 · 1 comment
Open

how to setup firebase config json #5

mreguly opened this issue Jan 9, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@mreguly
Copy link

mreguly commented Jan 9, 2019

I am not able to setup your library on localhost. I have found firebase settings example here https://github.com/firebase/firebase-admin-python/blob/master/tests/data/service_account.json

On firebase they only gave me this as a config

"apiKey": "some_key"
"authDomain": "some_link",
"databaseURL": "some_link",
"projectId": "some_id",
"storageBucket": "some_link",
"messagingSenderId": "some_id",

After hours I still can't find the answer.

I also don't know where to put SHA1 or SHA256 from firebase app settings

I am getting this error:

from rest_framework.routers import DefaultRouter

File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/site-packages/rest_framework/routers.py", line 28, in
from rest_framework import views
File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/site-packages/rest_framework/views.py", line 19, in
from rest_framework.schemas import DefaultSchema
File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/site-packages/rest_framework/schemas/init.py", line 32, in
authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,
File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/site-packages/rest_framework/settings.py", line 227, in getattr
val = perform_import(val, attr)
File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/site-packages/rest_framework/settings.py", line 172, in perform_import
return [import_from_string(item, setting_name) for item in val]
File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/site-packages/rest_framework/settings.py", line 172, in
return [import_from_string(item, setting_name) for item in val]
File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/site-packages/rest_framework/settings.py", line 183, in import_from_string
module = import_module(module_path)
File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/site-packages/rest_framework_firebase/authentication.py", line 16, in
creds = credentials.Certificate(api_settings.FIREBASE_ACCOUNT_KEY_FILE)
File "/home/guliver/.virtualenvs/djangox-3JrJ1blc/lib/python3.7/site-packages/firebase_admin/credentials.py", line 100, in init
'Caused by: "{0}"'.format(error))
ValueError: Failed to initialize a certificate credential. Caused by: "Incorrect padding"

@wesleylima
Copy link
Owner

It seems entering in each attribute directly in the config isn't working. However importing the whole config.json from firebase should work.

FIREBASE_AUTH = {
    'FIREBASE_ACCOUNT_KEY_FILE': 'path_to_your_credentials.json',
}

@wesleylima wesleylima added the bug Something isn't working label Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants