steam login using openID in android

Iam new to android development. my project is to make an application using steam public API but i couldn’t figure out how to allow the user to login using steam account.

Steam’s web API documentation states that i should use openID, So i searched alot to find an example implementing openID in an andorid app, but this is the only example i found and it doesn’t work, the webView just turns out blank.

i just want the user to click on a login button which fires a webView where he user can login and then get his steam ID back.

so my question is

  1. Is there a way to implement openID login in android?
  2. If not, is there anyway to allow the user to login steam?


I think i discovered some sort of a workaround i guess.

The steam openid can be used with a url request like this:

where REALM_PARAM is the website that will appear on the login screen, Also the user will be redirected to that website after authentication is complete, it doesn’t have to actually exist.
All you had to do after that is parse the new url for the user id.

So i used something like this

public class LoginActivity extends ActionBarActivity {

    // The string will appear to the user in the login screen  
    // you can put your app's name
    final String REALM_PARAM = "YourAppName";

    protected void onCreate(Bundle savedInstanceState) {

        final WebView webView = new WebView(this);

        final Activity activity = this;

        webView.setWebViewClient(new WebViewClient() {
            public void onPageStarted(WebView view, String url,
                                      Bitmap favicon) {

                //checks the url being loaded
                Uri Url = Uri.parse(url);

                    // That means that authentication is finished and the url contains user's id.

                    // Extracts user id.
                    Uri userAccountUrl = Uri.parse(Url.getQueryParameter("openid.identity"));
                    String userId = userAccountUrl.getLastPathSegment();

                    // Do whatever you want with the user's steam id 


                // Constructing openid url request
                String url = "" +
                        "openid.claimed_id=" +
                        "openid.identity=" +
                        "openid.mode=checkid_setup&" +
                        "openid.ns=" +
                        "openid.realm=https://" + REALM_PARAM + "&" +
                        "openid.return_to=https://" + REALM_PARAM + "/signin/";



Source : Link , Question Author : LimBo , Answer Author : LimBo

Leave a Comment