private void getToken(JSONArray args) {
        if (args == null || args.length() == 0) {
            return;
        }
        try {
            if (args.length() >= 5) {
                JSONArray jsonArray = args.getJSONArray(2);
                ArrayList<String> clientScopes = new ArrayList<String>();
                if (jsonArray != null) {
                    for (int i = 0; i < jsonArray.length(); i++) {
                        clientScopes.add(jsonArray.get(i).toString());
                    }
                }
                this.clientId = args.getString(0);
                this.clientSecret = args.getString(1);
                this.clientScopes = clientScopes;
                this.clientRedirectUri = args.getString(3);
                this.production = args.getBoolean(4);
                //todo send to background
                SSOHelper.getToken(this, this.cordova.getActivity(), clientId, clientSecret, clientScopes, clientRedirectUri, production);
            }
        } catch (JSONException e) {
            e.printStackTrace();
            callbackContext.error(e.getMessage());
        }
    }
private void getToken(JSONArray args) {
        if (args == null || args.length() == 0) {
            return;
        }
        try {
            if (args.length() >= 5) {
                JSONArray jsonArray = args.getJSONArray(2);
                ArrayList<String> clientScopes = new ArrayList<String>();
                if (jsonArray != null) {
                    for (int i = 0; i < jsonArray.length(); i++) {
                        clientScopes.add(jsonArray.get(i).toString());
                    }
                }
                this.clientId = args.getString(0);
                this.clientSecret = args.getString(1);
                this.clientScopes = clientScopes;
                this.clientRedirectUri = args.getString(3);
                this.production = args.getBoolean(4);
               
                SSOHelper.getToken(this, this.cordova.getActivity(), clientId, clientSecret, clientScopes, clientRedirectUri, production);
            }
        } catch (JSONException e) {
            e.printStackTrace();
            callbackContext.error(e.getMessage());
        }
    }
private void gettoken(jsonarray args) { if (args == null || args.length() == 0) { return; } try { if (args.length() >= 5) { jsonarray jsonarray = args.getjsonarray(2); arraylist<string> clientscopes = new arraylist<string>(); if (jsonarray != null) { for (int i = 0; i < jsonarray.length(); i++) { clientscopes.add(jsonarray.get(i).tostring()); } } this.clientid = args.getstring(0); this.clientsecret = args.getstring(1); this.clientscopes = clientscopes; this.clientredirecturi = args.getstring(3); this.production = args.getboolean(4); ssohelper.gettoken(this, this.cordova.getactivity(), clientid, clientsecret, clientscopes, clientredirecturi, production); } } catch (jsonexception e) { e.printstacktrace(); callbackcontext.error(e.getmessage()); } }