Login & Logout Buttons for OpenID + OAuth for Google, Yahoo, Facebook, Twitter



Login to website with Google Account / Google Login button for your website

  • Add / Integrate the Google login button to your website by following these steps
  • Discovery URL for Google OpenID is https://www.google.com/accounts/o8/id
  • Make a GET request to the Discovery URL with HTTP Header as "Accept: application/xrds+xml"
  • Parse the response XML to find out the Endpoint URL for Google OpenID services
  • Currently, the Endpoint URL for Google OpenID is https://www.google.com/accounts/o8/ud
  • To access Google Account data, register your website with Google here
    http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html
    and get your Google Consumer Key
  • OpenID+OAuth Reference Documents / Help Info are available here
  • Logic URL for the Google Login Button is given below with all params
  • https://www.google.com/accounts/o8/ud?
    openid.mode=checkid_setup
    &openid.ns= urlencode( http://specs.openid.net/auth/2.0 )
    &openid.return_to= urlencode( HTTP://YOUR-URL )
    &openid.realm= urlencode( HTTP://YOUR-DOMAIN )
    &openid.claimed_id= urlencode( http://specs.openid.net/auth/2.0/identifier_select )
    &openid.identity= urlencode( http://specs.openid.net/auth/2.0/identifier_select )
    &openid.ns.pape= urlencode( http://specs.openid.net/extensions/pape/1.0 )
    &openid.pape.max_auth_age=0
    &openid.ns.ui= urlencode( http://specs.openid.net/extensions/ui/1.0 )
    &openid.ui.mode=popup
    &openid.ui.icon=true
    &openid.ns.ax= urlencode( http://openid.net/srv/ax/1.0 )
    &openid.ax.mode=fetch_request
    &openid.ax.type.country= urlencode( http://axschema.org/contact/country/home )
    &openid.ax.type.email= urlencode( http://axschema.org/contact/email )
    &openid.ax.type.firstname= urlencode( http://axschema.org/namePerson/first )
    &openid.ax.type.lastname= urlencode( http://axschema.org/namePerson/last )
    &openid.ax.type.language= urlencode( http://axschema.org/pref/language )
    &openid.ax.type.fullname= urlencode( http://axschema.org/namePerson )
    &openid.ax.type.nickname= urlencode( http://axschema.org/namePerson/friendly )
    &openid.ax.type.image= urlencode( http://axschema.org/media/image/default )
    &openid.ax.type.gender= urlencode( http://example.com/schema/gender )
    &openid.ax.type.timezone= urlencode( http://axschema.org/pref/timezone )
    &openid.ax.required=country,email,firstname,lastname,language,fullname,nickname,image,gender,timezone
  • To get access to Google Account data using OAuth, you should include the following extra parameters in the login URL
  • &openid.ns.ext2= urlencode( http://specs.openid.net/extensions/oauth/1.0 )
    &openid.oauth.consumer=YOUR-GOOGLE-CONSUMER-KEY
    &openid.oauth.scope= urlencode( http://docs.google.com/feeds/ http://spreadsheets.google.com/feeds/ https://www.google.com/calendar/feeds/ )
  • The URL for Google Logout button is https://www.google.com/accounts/Logout
  • OpenID+OAuth Reference Documents / Help Info are available here

Login to website with Yahoo Account / Yahoo Login button for your website

  • Add / Integrate the Yahoo login button to your website by following these steps
  • Discovery URL for Yahoo OpenID is https://me.yahoo.com
  • Make a GET request to the Discovery URL with HTTP Header as "Accept: application/xrds+xml"
  • Parse the response XML to find out the Endpoint URL for Yahoo OpenID services
  • Currently, the Endpoint URL for Yahoo OpenID is https://open.login.yahooapis.com/openid/op/auth
  • To access Yahoo Account data, register your website with Yahoo here
    https://developer.yahoo.com/dashboard/createKey.html
    and get your Yahoo Consumer Key and Consumer Secret
  • OpenID+OAuth Reference Documents / Help Info are available here
  • Logic for the Yahoo Login Button is given below with all params
  • Fetch "Request Token" using
    https://open.login.yahooapis.com/openid/op/auth?
    openid.mode=checkid_setup
    &openid.ns= urlencode( http://specs.openid.net/auth/2.0 )
    &openid.return_to= urlencode( HTTP://YOUR-URL )
    &openid.realm= urlencode( HTTP://YOUR-DOMAIN )
    &openid.claimed_id= urlencode( http://specs.openid.net/auth/2.0/identifier_select )
    &openid.identity= urlencode( http://specs.openid.net/auth/2.0/identifier_select )
    &openid.ns.pape= urlencode( http://specs.openid.net/extensions/pape/1.0 )
    &openid.pape.max_auth_age=0
    &openid.ns.ui= urlencode( http://specs.openid.net/extensions/ui/1.0 )
    &openid.ui.mode=popup
    &openid.ui.icon=true
    &openid.ns.ax= urlencode( http://openid.net/srv/ax/1.0 )
    &openid.ax.mode=fetch_request
    &openid.ax.type.country= urlencode( http://axschema.org/contact/country/home )
    &openid.ax.type.email= urlencode( http://axschema.org/contact/email )
    &openid.ax.type.firstname= urlencode( http://axschema.org/namePerson/first )
    &openid.ax.type.lastname= urlencode( http://axschema.org/namePerson/last )
    &openid.ax.type.language= urlencode( http://axschema.org/pref/language )
    &openid.ax.type.fullname= urlencode( http://axschema.org/namePerson )
    &openid.ax.type.nickname= urlencode( http://axschema.org/namePerson/friendly )
    &openid.ax.type.image= urlencode( http://axschema.org/media/image/default )
    &openid.ax.type.gender= urlencode( http://example.com/schema/gender )
    &openid.ax.type.timezone= urlencode( http://axschema.org/pref/timezone )
    &openid.ax.required=country,email,firstname,lastname,language,fullname,nickname,image,gender,timezone
  • To get access to Yahoo Account data using OAuth, you should include the following extra parameters in the login URL
  • &openid.ns.oauth= urlencode( http://specs.openid.net/extensions/oauth/1.0 )
    &openid.oauth.consumer=YOUR-YAHOO-CONSUMER-KEY
  • Fetch "Access Token" using
    https://api.login.yahoo.com/oauth/v2/get_token?
    oauth_consumer_key=YOUR-YAHOO-CONSUMER-KEY
    &oauth_signature_method=PLAINTEXT
    &oauth_version=1.0
    &oauth_token=REQUEST-TOKEN-RETURNED-FROM-REQUEST
    &oauth_timestamp=CURRENT-TIMESTAMP-IN-UNIX-FORMAT
    &oauth_nonce=A-RANDOM-STRING
    &oauth_signature=CONCATENATED-CONSUMER-SECRET-AND-TOKEN-SECRET
  • Use the "Access Token" in your Yahoo API requests
  • The URL for Yahoo Logout button is http://login.yahoo.com/config/login?logout=1
  • OpenID+OAuth Reference Documents / Help Info are available here

Login to website with Facebook Account / Facebook Login button for your website

  • Add / Integrate the Facebook login button to your website by following these steps
  • Register your website app with Facebook here
    https://developers.facebook.com/apps
    and get your Facebook App Id And App Secret
  • Reference Documents / Help Info are available here
  • Logic for the Facebook Login Button is given below with all params
  • Fetch "Code" using
    https://www.facebook.com/dialog/oauth?
    client_id=YOUR-FACEBOOK-APP-ID
    &redirect_uri= urlencode( HTTP://YOUR-URL )
    &scope=email,read_stream
  • Fetch "Access Token" using
    https://graph.facebook.com/oauth/access_token?
    client_id=YOUR-FACEBOOK-APP-ID
    &redirect_uri= urlencode( HTTP://YOUR-URL )
    &client_secret=YOUR-FACEBOOK-APP-SECRET
    &code=CODE-RETURNED-FROM-REQUEST
  • Fetch "User Data" using https://graph.facebook.com/me?access_token=ACCESS-TOKEN-RETURNED-FROM-REQUEST
  • Fetch all the Facebook Graph Data using the "Access Token"
  • Reference Documents / Help Info are available here
  • The URL for Facebook Logout button is
    https://www.facebook.com/logout.php?
    next= urlencode( HTTP://YOUR-URL )
    &access_token=ACCESS-TOKEN-RETURNED-FROM-REQUEST

Login to website with Twitter Account / Twitter Login button for your website

  • Add / Integrate the Twitter login button to your website by following these steps
  • Register your website app with Twitter here
    https://dev.twitter.com/apps/new
    and get your App Key
  • Reference Documents / Help Info are available here
  • HTML Code for the Twitter Login Button is given below
  • <script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&v=1" type="text/javascript"></script>
    <span id="login"></span>
    <script type="text/javascript">
    twttr.anywhere(function (T) {
    	T("#login").connectButton();
    });
    </script>
    
  • Reference Documents / Help Info are available here









Leave your Comments here (Confidential & Visible only to Us)