dounou9751 2010-10-16 14:00
浏览 87
已采纳

混合演示不返回oauth请求令牌

I'm having a lot of trouble getting started with creating a google apps marketplace application.

I've tried numerous demos, including the php hello world example you can download from google. In every case, the openid portion works fine, but oauth is failing.

I've tracked it down to the hybrid openid/oauth request not returning an oauth request token. You can see my verion of the hybrid standard demo from googlecodesamples here http://lookmumimontheinternet.com/staging/hybrid/index.php

You can see that i'm stopping the redirect and outputting the url in a link for debugging. I'm also outputting everything that comes back in the $_REQUEST object.

This is linked up to a market place app with the folowing manifest:

<?xml version="1.0" encoding="UTF-8" ?>
<ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009">
  <!-- Metadata -->
  <Name>Hello World</Name>
  <Description>A simple application for demonstrating the marketplace</Description>
  <Support>
    <Link rel="support" href="http://www.lookmumimontheinternet.com/staging/hybrid/support.php" />
  </Support>

  <!-- Navigation link -->
  <Extension id="navlink" type="link">
    <Name>Hello World</Name>
    <Url>http://www.lookmumimontheinternet.com/staging/hybrid/index.php?from=google&amp;domain=${DOMAIN_NAME}</Url>
    <Scope ref="calendarFeed"/>
  </Extension>

  <!-- Single Sign On with OpenID -->
  <Extension id="realm" type="openIdRealm">
    <Url>http://lookmumimontheinternet.com/staging/hybrid</Url>
  </Extension>

  <!-- Authorized Data access -->
  <Scope id="calendarFeed">
    <Url>https://www.google.com/calendar/feeds/</Url>
    <Reason>This app displays your next upcoming calendar appointment..</Reason>
  </Scope>
</ApplicationManifest>

here is the php configuration of my installation of the demo (I know I shouldn't post the secret but it's only a test app):

$CONSUMER_KEY = '995079586589.apps.googleusercontent.com';
$CONSUMER_SECRET = '6yTp+2Xz7nSqB4Yx6OdSds7n';

$openid_params = array(
  'openid.ns'                => 'http://specs.openid.net/auth/2.0',
  'openid.claimed_id'        => 'http://specs.openid.net/auth/2.0/identifier_select',
  'openid.identity'          => 'http://specs.openid.net/auth/2.0/identifier_select',
  'openid.return_to'         => "http://lookmumimontheinternet.com/staging/hybrid/index.php",
  'openid.realm'             => "http://lookmumimontheinternet.com/staging/hybrid",
  'openid.mode'              => @$_REQUEST['openid_mode'],
  'openid.ns.ui'             => 'http://specs.openid.net/extensions/ui/1.0',
  'openid.ns.ext1'           => 'http://openid.net/srv/ax/1.0',
  'openid.ext1.mode'         => 'fetch_request',
  'openid.ext1.type.email'   => 'http://axschema.org/contact/email',
  'openid.ext1.type.first'   => 'http://axschema.org/namePerson/first',
  'openid.ext1.type.last'    => 'http://axschema.org/namePerson/last',
  'openid.ext1.type.country' => 'http://axschema.org/contact/country/home',
  'openid.ext1.type.lang'    => 'http://axschema.org/pref/language',
  'openid.ext1.required'     => 'email,first,last,country,lang',
  'openid.ns.oauth'          => 'http://specs.openid.net/extensions/oauth/1.0',
  'openid.oauth.consumer'    => $CONSUMER_KEY,
  'openid.oauth.scope'       => implode(' ', $scopes)
);

$openid_ext = array(
  'openid.ns.ext1'           => 'http://openid.net/srv/ax/1.0',
  'openid.ext1.mode'         => 'fetch_request',
  'openid.ext1.type.email'   => 'http://axschema.org/contact/email',
  'openid.ext1.type.first'   => 'http://axschema.org/namePerson/first',
  'openid.ext1.type.last'    => 'http://axschema.org/namePerson/last',
  'openid.ext1.type.country' => 'http://axschema.org/contact/country/home',
  'openid.ext1.type.lang'    => 'http://axschema.org/pref/language',
  'openid.ext1.required'     => 'email,first,last,country,lang',
  'openid.ns.oauth'          => 'http://specs.openid.net/extensions/oauth/1.0',
  'openid.oauth.consumer'    => $CONSUMER_KEY,
  'openid.oauth.scope'       => implode(' ', $scopes),
  'openid.ui.icon'           => 'true'
);

You can see when you run the demo that no oauth token is being returned even though it is being requested (correctly as far as i can see). Can anybody see what i'm doing wrong here?

  • 写回答

1条回答 默认 最新

  • doufangzhang4454 2011-04-05 05:46
    关注

    Ok solved it. Because apps are pre-approved when installed, you don't need to get oauth access. You have it already with your app key.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?