Update routes/sendnotifications.py
Browse files
routes/sendnotifications.py
CHANGED
@@ -16,9 +16,11 @@ def get_access_token():
|
|
16 |
credentials = service_account.Credentials.from_service_account_file(
|
17 |
SERVICE_ACCOUNT_FILE
|
18 |
)
|
19 |
-
scoped_credentials = credentials.with_scopes(
|
|
|
|
|
20 |
scoped_credentials.refresh(Request())
|
21 |
-
return
|
22 |
|
23 |
@router.get("/send-test-notification")
|
24 |
async def send_test_notification():
|
|
|
16 |
credentials = service_account.Credentials.from_service_account_file(
|
17 |
SERVICE_ACCOUNT_FILE
|
18 |
)
|
19 |
+
scoped_credentials = credentials.with_scopes(
|
20 |
+
['https://www.googleapis.com/auth/firebase.messaging']
|
21 |
+
)
|
22 |
scoped_credentials.refresh(Request())
|
23 |
+
return scoped_credentials.token # CORRETO: use as credenciais com escopo!
|
24 |
|
25 |
@router.get("/send-test-notification")
|
26 |
async def send_test_notification():
|