2012-01-17 4 views
1

を返します:)のOpenID(Gmailやmyopenid)は電子メールのみ

これは私がopenid4javaを使用して行われた要求です。

DiscoveryInformation discovered = manager.associate(discoveries); 
System.out.println("discovered"); 
// store the discovery information in the user's session 
session.setAttribute("openid-disco", discovered); 

// obtain a AuthRequest message to be sent to the OpenID provider 
AuthRequest authReq = manager.authenticate(discovered, returnToUrl); 
System.out.println("authReq Ok"); 

// Attribute Exchange example: fetching the 'email' attribute 
FetchRequest fetch = FetchRequest.createFetchRequest(); 
System.out.println("fetch"); 

fetch.addAttribute("gender",       // attribute alias 
        "http://schema.openid.net/gender", // type URI 
        true); 
fetch.addAttribute("email", 
        "http://schema.openid.net/contact/email", 
        true); 
fetch.addAttribute("first", 
        "namePerson/first", 
        true); 
// attach the extension to the authentication request 
authReq.addExtension(fetch); 

そして、これは私が受け取る応答です。

openid.assoc_handle={HMAC-SHA256}{4f156b67}{jEurHw%3D%3D}& 
openid.ax.count.email=1 
&openid.ax.count.first=0 
&openid.ax.count.gender=0 
&openid.ax.mode=fetch_response& 
openid.ax.type.email=http%3A%2F%2Fschema.openid.net%2Fcontact%2Femail& 
openid.ax.type.first=namePerson%2Ffirst& 
openid.ax.type.gender=http%3A%2F%2Fschema.openid.net%2Fgender 
&openid.ax.value.email.1=saad.alothman%40gmail.com 
&openid.claimed_id=http%3A%2F%2Fsaad-alothman.myopenid.com%2F 
&openid.identity=http%3A%2F%2Fsaad-alothman.myopenid.com%2F 
&openid.mode=id_res 
&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0 
&openid.ns.ax=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0 
&openid.op_endpoint=http%3A%2F%2Fwww.myopenid.com%2Fserver& 
openid.response_nonce=2012-01-17T14%3A32%3A26ZvN5JP4 
&openid.return_to=https%3A%2F%2F192.168.133.17%3A10029%2Fwps%2FPA_openIdTest%2Fconsumer_returnurl.jsp 
&openid.sig=8%2FES2uury7SxehrYVlH9gef9pB3l1eNQzCLqFJDTXDk%3D& 

は、私はプロバイダなどmyopenidやGmailを試みたが、それだけで電子メールを送信します。あなたが気づくように、まず名前と性別カウントは0です。私のページがリダイレクトされたときのプロバイダのページから、私のコードで必要とされたものの1つだけが電子メールで表示されますが、名前と性別が追加されています。

名前、性別、DOBなどのメール以外の情報を取得したいと考えています。

Upadte:私はSREG拡張オブジェクトを使用して、私は三つの値(名前、メールアドレス、ニックネーム) しかし、まだアドレスのような他の値を取得できるようにしたいです...

+0

私は認証後にGmailからの応答パラメータを取得していませんが、どこに問題があるのか​​教えてください。 –

+0

google aapsにドメインを登録する必要がありますか? –

答えて