You have to use moderator scope:
https://www.googleapis.com/auth/moderator

As explained in the Moderator API documentation:
http://code.google.com/apis/moderator/v1/using_rest.html

On Mon, Jun 20, 2011 at 11:27 AM, Saurabh S <[email protected]> wrote:
> Thanks Johan,that error has been resolved.
>
> Now after that it says invalid scope.
> Error:OAuth 2.0 error: invalid_scope
>
> Is there any particular URL for scope or I have to manually enter a
> url on a particular basis
>
> Can you please provide information on this
>
> On Jun 20, 12:35 pm, Johan Euphrosine <[email protected]> wrote:
>> Hi Rohit,
>>
>> If you are running dev_appserver.py,
>>
>> make sure the list of Redirect URIs in theGoogleAPIs Console/Api
>> access section:https://code.google.com/apis/console/
>>
>> Contains:http://localhost:8080/oauth2callback
>>
>> Note http:// not https://.
>>
>> If you are running the deployed version, make sure it 
>> contains:https://myappid.appspot.com/oauth2callbackhttp://myappid.appspot.com/oauth2callback
>>
>> Or both depending if you enforce SSL if you application.
>>
>> Hope that helps.
>>
>> On Mon, Jun 20, 2011 at 8:49 AM, GAEappdeveloper
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> <[email protected]> wrote:
>> > Thanks Johan
>> > Even though I have signed in using my Gmail account it does not seem
>> > to make any difference. It is displaying the same error.
>>
>> > And also i tried using the oauthdecorator
>> > 1. when I click on yes or no button for a particular submission it
>> > requests for login and after I sign in it displays this error:
>> > OAuth 2.0 error: redirect_uri_mismatch
>> > The redirect URI in the request did not match a registered redirect
>> > URI
>>
>> > Can you please tell why this error appears and how to solve this
>> > On Jun 18, 4:17 am, Johan Euphrosine <[email protected]> wrote:
>> >> get_current_user() could return None has documented here, if no user
>> >> is logged 
>> >> in:http://code.google.com/appengine/docs/python/users/functions.html
>>
>> >> You could also take a look at the new OAuth2Decorator in
>> >>google-api-python-client that make dealing with OAuth 2.0 
>> >>easier:http://code.google.com/p/google-api-python-client/wiki/OAuth2AppEngin...
>>
>> >> I just published an article on how to use it withGoogleTasks API,
>> >> but that should be easy to translate to Moderator 
>> >> API:http://googleappengine.blogspot.com/2011/06/getting-started-with-task...
>>
>> >> On Fri, Jun 17, 2011 at 2:45 PM, GAEappdeveloper
>>
>> >> <[email protected]> wrote:
>> >> > Hi,
>>
>> >> > I am developing anGoogleappengineapplication using Moderator API
>> >> > in python. I am able to retrieve the submissions. I am having an
>> >> >authenticationproblem. My code runs locally without anyproblembut
>> >> > when I deploy it inGoogleappenginelauncher. It shows the following
>> >> > error:
>>
>> >> > 'NoneType' object has no attribute 'user_id'
>> >> > Traceback (most recent call last):
>> >> >  File "/base/python_runtime/python_lib/versions/1/google/appengine/
>> >> > ext/webapp/__init__.py", line 700, in __call__
>> >> >    handler.get(*groups)
>> >> >  File "/base/data/home/apps/ktbookstore/3.351197542995528852/
>> >> > retrieve_list_unique.py", line 107, in get
>> >> >    f = Flow.get_by_key_name(user.user_id())
>> >> > AttributeError: 'NoneType' object has no attribute 'user_id'
>>
>> >> > My code is:
>>
>> >> > import gflags
>> >> > import httplib2
>> >> > import logging
>> >> > import pprint
>> >> > import sys
>> >> > import os
>> >> > import cgi
>> >> > import pickle
>>
>> >> > from apiclient.discovery import build
>> >> > from oauth2client.file import Storage
>> >> > from oauth2client.client import AccessTokenRefreshError
>> >> > from oauth2client.client import OAuth2WebServerFlow
>> >> > from oauth2client.tools import run
>> >> > fromgoogle.appengine.ext import webapp
>> >> > fromgoogle.appengine.ext.webapp import template
>> >> > fromgoogle.appengine.ext.webapp.util import run_wsgi_app
>> >> > fromgoogle.appengine.ext import db
>> >> > fromgoogle.appengine.api import users
>> >> > from oauth2client.appengine import CredentialsProperty
>> >> > from oauth2client.appengine import StorageByKeyName
>> >> > fromgoogle.appengine.ext.webapp.util import login_required
>> >> > fromgoogle.appengine.api import memcache
>> >> > from oauth2client.appengine import FlowProperty
>>
>> >> > FLAGS = gflags.FLAGS
>>
>> >> > FLOW = OAuth2WebServerFlow(
>> >> >    client_id='My client id',
>> >> >    client_secret='my client_secret',
>> >> >    scope='https://www.example.com/oauth2callback',
>> >> >    user_agent='moderator-cmdline-sample/1.0')
>>
>> >> > gflags.DEFINE_enum('logging_level', 'ERROR',['DEBUG', 'INFO',
>> >> > 'WARNING', 'ERROR', 'CRITICAL'],'Set the level of logging detail.')
>>
>> >> > class Flow(db.Model):   # FlowThreeLegged could also be stored in
>> >> > memcache.
>> >> >    flow = FlowProperty()
>>
>> >> > class Credentials(db.Model):
>> >> >  credentials = CredentialsProperty()
>>
>> >> > class ModPage(webapp.RequestHandler):
>> >> >  def get(self):
>> >> >    # Let the gflags module process the command-line arguments
>>
>> >> >    service = build("moderator", "v1", developerKey='my developer
>> >> > key')
>>
>> >> > class voteUpdate(webapp.RequestHandler):
>> >> >  def get(self):
>> >> >      user = users.get_current_user()
>> >> >      logging.info(user)
>> >> >      f = Flow.get_by_key_name(user.user_id())
>> >> >      if f:
>> >> >        credentials = f.flow.step2_exchange(self.request.params)
>> >> >        c = Credentials(key_name=user.user_id(),
>> >> > credentials=credentials)
>> >> >        c.put()
>> >> >        f.delete()
>> >> >        self.redirect("/")
>> >> >      else:
>> >> >        pass
>> >> >      user = users.get_current_user()
>> >> >      c = Credentials.get_by_key_name(user.user_id())
>> >> >      if c:
>> >> >        http = httplib2.Http()
>> >> >        http = c.credentials.authorize(http)
>> >> >      else:
>> >> >        flow = FlowThreeLegged(
>> >> >                              consumer_key='',
>> >> >                              consumer_secret='anonymous',
>> >> >                              user_agent='google-api-client-python-
>> >> > moderator-webapp/1.0',
>> >> >                              domain='anonymous',
>> >> >                              scope='https://www.googleapis.com/auth/
>> >> > moderator',
>> >> >                              xoauth_displayname='Example WebApp')
>> >> >      authorize_url = flow.step1_get_authorize_url(STEP2_URI)
>> >> >      f = Flow(key_name=user.user_id(), flow=flow)
>> >> >      f.put()
>> >> >      self.redirect(authorize_url)
>>
>> >> >      service = build("moderator", "v1", http=http,developerKey='my
>> >> > developer key')
>>
>> >> >      minus=self.request.get("Minus")
>> >> >      if minus=="":
>> >> >        self.response.out.write("plus")
>> >> >        #code which will increment plus vote counter by 1
>> >> >      else:
>> >> >        self.response.out.write("minus")
>> >> >        #code which will increment minus vote counter by 1
>>
>> >> > application = webapp.WSGIApplication([
>> >> >  ('/', ModPage),('/vote',voteUpdate)
>> >> > ], debug=True)
>>
>> >> > def main():
>> >> >   run_wsgi_app(application)
>>
>> >> > if __name__ == '__main__':
>> >> >  main()
>>
>> >> > Please help me in finding the solution.
>>
>> >> > --
>> >> > You received this message because you are subscribed to theGoogleGroups 
>> >> > "GoogleAppEngine" group.
>> >> > To post to this group, send email [email protected].
>> >> > To unsubscribe from this group, send email 
>> >> > [email protected].
>> >> > For more options, visit this group 
>> >> > athttp://groups.google.com/group/google-appengine?hl=en.
>>
>> >> --
>> >> Johan Euphrosine (proppy)
>> >> Developer Programs Engineer
>> >>GoogleDeveloper Relations
>>
>> > --
>> > You received this message because you are subscribed to theGoogleGroups 
>> > "GoogleAppEngine" group.
>> > To post to this group, send email [email protected].
>> > To unsubscribe from this group, send email 
>> > [email protected].
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/google-appengine?hl=en.
>>
>> --
>> Johan Euphrosine (proppy)
>> Developer Programs EngineerGoogleDeveloper Relations
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine?hl=en.
>
>



-- 
Johan Euphrosine (proppy)
Developer Programs Engineer
Google Developer Relations

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to