0

私はOpenIDの概念に不慣れで、最近、 JanRainPHP5システムを使用してCodeIgniter用のOpenIDライブラリを実装しようとしました。しかし、グーグルやヤフーのようなサイトから単純なデータを取得しているときにいくつかの問題に遭遇しました...

OpenIDライブラリの設定ファイルは次のようになります。

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    $config['openid_storepath'] = 'tmp';
    $config['openid_policy'] = 'test/policy';
    $config['openid_required'] = array('email');
    $config['openid_optional'] = array('fullname');
    $config['openid_request_to'] = 'test/check';
?>

それでも、「email」または「fullname」の値を取得できません。他のフィールド(「ニックネーム」など)に入力しようとしましたが、結果も得られませんでした。さらに、JanRainドキュメントで指定されている他の多くのオプション(「verifiedEmail」や「preferredUsername」など)は、単にSREGエラーを引き起こしました。

認証は成功メッセージを返すため成功しますが、要求した情報にアクセスするにはどうすればよいですか?

編集:ここにリターンURLがあります:

http://www.{Site}.net/v2/test/check?janrain_nonce=2011-12-10T05:53:01ZFXVT02&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.return_to=http%3A%2F%2Fwww.{Site}.net%2Fv2%2Ftest%2Fcheck%3Fjanrain_nonce%3D2011-12-10T05%3A53%3A01ZFXVT02&openid.claimed_id=https%3A%2F%2Fme.yahoo.com%2Fa%2F{Token}%23df6f7&openid.identity=https%3A%2F%2Fme.yahoo.com%2Fa%2F{Token}&openid.assoc_handle={Handle}&openid.realm=http%3A%2F%2Fwww.{Site}.net%2Fv2%2F&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.response_nonce=2011-12-10T05%3A53%3{Nonce Token}&openid.signed=assoc_handle%2Cclaimed_id%2Cidentity%2Cmode%2Cns%2Cop_endpoint%2Cresponse_nonce%2Creturn_to%2Csigned%2Cpape.auth_level.nist&openid.op_endpoint=https%3A%2F%2Fopen.login.yahooapis.com%2Fopenid%2Fop%2Fauth&openid.pape.auth_level.nist=0&openid.sig=CUa39ZjhGE8nWc7TMvbS8UFlwjQ%3D

ありがとう!

4

1 に答える 1

0

私はPHPであなたを助けることはできませんが、yahooで動作するJavaで開発したコードを表示できます

私がAuthenticationUrl()yahooのために作成している間、これは私がしていることです

 StringBuilder sb = new StringBuilder(1024);
        sb.append(endpoint.getUrl())
          .append(endpoint.getUrl().contains("?") ? '&' : '?')
          .append(getAuthQuery(endpoint.getAlias()))
          .append("&openid.return_to=")
          .append(returnToUrlEncode)
          .append("&openid.assoc_handle=")

これが私のgetAuthQuery機能です

 String getAuthQuery(String axa) {
        if (authQuery!=null)
            return authQuery;
        List<String> list = new ArrayList<String>();
        list.add("openid.ns=http://specs.openid.net/auth/2.0");
        list.add("openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select");
        list.add("openid.identity=http://specs.openid.net/auth/2.0/identifier_select");
        list.add("openid.mode=checkid_setup");
        list.add("openid.ns." + axa + "=http://openid.net/srv/ax/1.0");
        list.add("openid." + axa + ".mode=fetch_request");
        list.add("openid." + axa + ".type.email=http://axschema.org/contact/email");
        list.add("openid." + axa + ".type.fullname=http://axschema.org/namePerson");
        list.add("openid." + axa + ".type.language=http://axschema.org/pref/language");
        list.add("openid." + axa + ".type.firstname=http://axschema.org/namePerson/first");
        list.add("openid." + axa + ".type.lastname=http://axschema.org/namePerson/last");
        list.add("openid." + axa + ".type.gender=http://axschema.org/person/gender");
        list.add("openid." + axa + ".required=email,fullname,language,firstname,lastname,gender");
        String query = Utils.buildQuery(list);
        authQuery = query;
        return query;
    }

これにより、属性交換の使用方法がわかることを願っています。

于 2011-12-10T06:34:43.603 に答える