Skip to content

google.oauth2.service_account.Credentials is not assignable to google.oauth2.credentials.Credentials #367

Description

@vincentfenet

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions