google.oauth2.service_account.Credentials is not assignable to google.oauth2.credentials.Credentials
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 814
- Forks
- 209
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
While migrating from 2.0.7 to 2.0.8, i got a pyright check error.
Using a very simple test:
from google.oauth2 import service_account
from pyfcm import FCMNotification
gcp_json_credentials_dict = {}
credentials = service_account.Credentials.from_service_account_info(
gcp_json_credentials_dict,
scopes=["https://www.googleapis.com/auth/firebase.messaging"],
)
fcm = FCMNotification(
credentials=credentials, project_id="<project-id>"
)
Here is the error:
test.py:11:17 - error: Argument of type "Credentials" cannot be assigned to parameter "credentials" of type "Credentials" in function "__init__"
"google.oauth2.service_account.Credentials" is not assignable to "google.oauth2.credentials.Credentials" (reportArgumentType)
1 error, 0 warnings, 0 informations
Not sure, but it looks like you need to use the right "Credentials" class here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pyfcm/baseapi.py at the credentials reference identified in the issue, then compare it with the google.oauth2 service-account and general credentials classes. Reproduce the reported error using the test.py example and run pyright. Done means the example accepts service_account.Credentials without the reported type error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- firebase, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100