sullivanmatt
sullivanmatt

Reputation: 740

What's required in order to get OAuth2 credentials for my marketplace app?

I've created a small application that utilizes the recently announced Gmail API to search received e-mails for a specific string. My new is app published as hidden in the Chrome / Google Apps store, and I've read that I should be given OAuth2 credentials to use with my application.

For example, this guide (for the old apps marketplace, which is no longer usable) shows where a developer can go to grab credentials for their marketplace app:

enter image description here

However in the new store, I cannot find anywhere that makes these credentials available to me.

Have I missed a step? Do I need to complete a Google Apps Marketplace Listing Review Request in order to be provided credentials?

Thanks!

Updated with solution

The user MeLight has the answer below - generate service account credentials, then use them after making sure that the project has been linked to the marketplace app in the Chrome Web Store. For any future Googlers, here's the code used to connect to the API and create a service object, which can be used for getting messages, etc.

from oauth2client.client import SignedJwtAssertionCredentials
from apiclient.discovery import build
from oauth2client.tools import run
import os
import httplib2


BASEDIR = os.path.dirname(__file__)
PRIVATE_KEY = BASEDIR + "XXXX-privatekey.p12"
SERVICE_ACCOUNT_EMAIL = "[email protected]"
SCOPES = ["https://mail.google.com/"]
USERNAME="[email protected]"

def main(argv):
        f = file(PRIVATE_KEY, 'rb')
        key = f.read()
        f.close()

        credentials = SignedJwtAssertionCredentials(service_account_name=SERVICE_ACCOUNT_EMAIL,
                                                    private_key=key,
                                                    scope=" ".join(SCOPES),
                                                    prn=USERNAME)

        http = httplib2.Http()

        # Authorize the httplib2.Http object with our credentials
        http = credentials.authorize(http)

        # Build the Gmail service from discovery
        service = build('gmail', 'v1', http=http)

Upvotes: 2

Views: 284

Answers (1)

MeLight
MeLight

Reputation: 5555

You need to go to the Cloud Console, you can find it here: https://console.developers.google.com/

Find your project in the list and click it. From there APIs & AUTH -> Credentials.

You should see a list of clients and their credentials. You'll need a Service Account - you can create one if it's not already there.

Upvotes: 3

Related Questions