0

I'm new to the OpenID concept and recently tried implementing an OpenID Library for CodeIgniter using the JanRain PHP 5 system. However ran into some issues while retrieving simple data from sites like Google and Yahoo...

My config file for the OpenID Library looks like this:

<?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';
?>

Yet, I'm unable to obtain either the 'email' or 'fullname' value. I've tried filling in other fields (like 'nickname'), but that didn't yield results either. In addition, many other options specified in JanRain docs (such as 'verifiedEmail' and 'preferredUsername') merely caused an SREG error.

The authentications are successful, as they return a success message, but how can I access the information I've requested?

Edit: Here is the return 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

Thanks!

drfranks3
  • 667
  • 8
  • 21
  • Refer this. http://thinkmoult.com/2009/02/22/use-codeigniter-openid-library-to-integrate-openid/ – Rohan Patil Dec 10 '11 at 04:03
  • @RohanPatil I have been following that guide and reading some of the comments, but have yet to find a solution... – drfranks3 Dec 10 '11 at 05:42
  • @DFranks i assume that you have redirected user to yahoo/google and they have logged in and are being redirected back to your application.if this is the case can you show the URL and its parameters? – Umesh Awasthi Dec 10 '11 at 05:55
  • @umeshawasthi I've edited in the return url above. – drfranks3 Dec 10 '11 at 06:10
  • @DFranks why don't you are using attribute exchange in Yahoo it supports this thing and it will give you back what you are expecting from it. – Umesh Awasthi Dec 10 '11 at 06:27

1 Answers1

0

I can't help you in PHP but can show you code i have developed in java which work for yahoo

while i am creating AuthenticationUrl() for yahoo this is what i am doing

 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=")

here is my getAuthQuery function

 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;
    }

hope this will give you idea how to use attribute exchange.

Umesh Awasthi
  • 23,407
  • 37
  • 132
  • 204
  • Thank you very much! In addition to your code, this [replacement](http://codeigniter.com/wiki/A3M_Account_Authentication_and_Authorization) helped solve my problem. :) – drfranks3 Dec 14 '11 at 03:08