iphone - Google Data/OAuth/AppEngine/Python - 正确注册 Web 应用程序

标签 iphone python google-app-engine oauth google-data-api

我正在使用这些工具组合创建一个网络应用程序。我通过以下方式使用 App Engine 进行身份验证:

class googleLogin(webapp.RequestHandler):
  def get(self):
    callbackURL = 'http://%s/googleLoginCallback' % getHost()

    #Create a client service
    gdClient = gdata.docs.service.DocsService()
    gdata.alt.appengine.run_on_appengine(gdClient)
    gdClient.SetOAuthInputParameters(gdata.auth.OAuthSignatureMethod.HMAC_SHA1, 
                                     _GoogleConsumerKey, 
                                     consumer_secret=_GoogleConsumerSecret)

    #Get a Request Token        
    requestToken = gdClient.FetchOAuthRequestToken(scopes=_GoogleDataScope,
                                                   extra_parameters={'xoauth_displayname': APP_NAME})

    #Persist token secret
    self.session = Session()
    self.session[TOKENSECRETKEY]        = requestToken.secret

    gdClient.auto_set_current_token = True
    gdClient.SetOAuthToken(requestToken)
    authUrl = gdClient.GenerateOAuthAuthorizationURL(callback_url=callbackURL)
    self.redirect(authUrl)

我通过 Google 验证了我的域名 https://www.google.com/accounts/ManageDomain ,输入目标 URL 并使用给定的消费者 key / secret 。例如,如果我的域名是“juno.appspot.com”,则我使用 http://juno.appspot.com作为目标 url 路径前缀。

进程正在运行;但是,Google 在黄色安全框中向用户显示此消息:

"The application that directed you here claims to be 'xxxxxx'. We are unable to verify this claim as the application runs on your computer, as opposed to a website. We recommend that you deny access unless you trust the application."

我认为我不应该收到此错误,因为我的服务器正在获取请求 token 并创建授权 URL。有谁知道如何消除此警告吗?

Google 的域名注册可以选择上传证书,但我不需要这样做,因为我使用的是带有 HMAC_SHA1 签名方法的 OAuth。

另外,这并不重要,但我是通过 iPhone 上的 UIWebView 完成这一切的。我特别尝试在服务器端进行所有身份验证,以避免暴露我的消费者 key / secret 。

感谢您的任何提示:)

最佳答案

已解决。

罪魁祸首是上面的这一行:

extra_parameters={'xoauth_displayname': APP_NAME})

为已注册的应用程序设置此值会故意向用户触发警告,如 Google 文档所示:

xoauth_displayname:

(optional) String identifying the application. This string is displayed to end users on Google's authorization confirmation page. For registered applications, the value of this parameter overrides the name set during registration and also triggers a message to the user that the identity can't be verified. For unregistered applications, this parameter enables them to specify an application name, In the case of unregistered applications, if this parameter is not set, Google identifies the application using the URL value of oauth_callback; if neither parameter is set, Google uses the string "anonymous".

删除这一行不再允许我使用“好”的名称来代替域名,但它消除了那个烦人的黄色框:)

关于iphone - Google Data/OAuth/AppEngine/Python - 正确注册 Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5527116/

相关文章:

java - Objectify:查询外键内容

iphone - IOS需要根据关键价格对字典值数组进行排序

iphone - 在 uiimagePickerController 完成后呈现一个带有模态的 viewController

iphone - 在 iOS 设备上同时使用前后(主要和次要)相机

python - Pandas :排序数据透视表

python - 如何使 Flask/Jinja2 加载可执行 zip 存档中的捆绑模板?

iphone - 选择的 UIButton 不起作用

python 使用 groupby 滚动累积返回

google-app-engine - Google Cloud Storage 返回我的公共(public)文件的 NoSuchKey

java - 如何使 GAE 应用程序可永久禁止下载