steam login using openID in android -


iam new android development. project make application using steam public api couldn't figure out how allow user login using steam account.

steam's web api documentation states should use openid, searched alot find example implementing openid in andorid app, this example found , doesn't work, webview turns out blank.

i want user click on login button fires webview user can login , steam id back.

so question is

  1. is there way implement openid login in android?
  2. if not, there anyway allow user login steam?

i think discovered sort of workaround guess.

the steam openid can used url request this:

https://steamcommunity.com/openid/login? openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select& openid.identity=http://specs.openid.net/auth/2.0/identifier_select& openid.mode=checkid_setup& openid.ns=http://specs.openid.net/auth/2.0& openid.realm=https://realm_param& openid.return_to=https://realm_param/signin/ 

where realm_param website appear on login screen, user redirected website after authentication complete, doesn't have exist. had after parse new url user id.

so used this

public class loginactivity extends actionbaractivity {      // string appear user in login screen       // can put app's name     final string realm_param = "yourappname";      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          final webview webview = new webview(this);         webview.getsettings().setjavascriptenabled(true);          final activity activity = this;          webview.setwebviewclient(new webviewclient() {             @override             public void onpagestarted(webview view, string url,                                       bitmap favicon) {                  //checks url being loaded                 settitle(url);                 uri url = uri.parse(url);                  if(url.getauthority().equals(realm_param.tolowercase())){                     // means authentication finished , url contains user's id.                     webview.stoploading();                      // extracts user id.                     uri useraccounturl = uri.parse(url.getqueryparameter("openid.identity"));                     string userid = useraccounturl.getlastpathsegment();                      // whatever want user's steam id                   });                 setcontentview(webview);                  // constructing openid url request                 string url = "https://steamcommunity.com/openid/login?" +                         "openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&" +                         "openid.identity=http://specs.openid.net/auth/2.0/identifier_select&" +                         "openid.mode=checkid_setup&" +                         "openid.ns=http://specs.openid.net/auth/2.0&" +                         "openid.realm=https://" + realm_param + "&" +                         "openid.return_to=https://" + realm_param + "/signin/";                  webview.loadurl(url);              }         } 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -