Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's code I've been using successfully for authentication. Maybe this helps even though this is not related to Smack in any way. You can get sessionKey from access token received from FB, and for getting sessionSecret I've been using oldish REST API;</p> <p><a href="http://developers.facebook.com/docs/reference/rest/auth.promoteSession/" rel="nofollow">http://developers.facebook.com/docs/reference/rest/auth.promoteSession/</a></p> <pre><code>private final void processChallenge(XmlPullParser parser, Writer writer, String sessionKey, String sessionSecret) throws IOException, NoSuchAlgorithmException, XmlPullParserException { parser.require(XmlPullParser.START_TAG, null, "challenge"); String challenge = new String(Base64.decode(parser.nextText(), Base64.DEFAULT)); String params[] = challenge.split("&amp;"); HashMap&lt;String, String&gt; paramMap = new HashMap&lt;String, String&gt;(); for (int i = 0; i &lt; params.length; ++i) { String p[] = params[i].split("="); p[0] = URLDecoder.decode(p[0]); p[1] = URLDecoder.decode(p[1]); paramMap.put(p[0], p[1]); } String api_key = "YOUR_API_KEY"; String call_id = "" + System.currentTimeMillis(); String method = paramMap.get("method"); String nonce = paramMap.get("nonce"); String v = "1.0"; StringBuffer sigBuffer = new StringBuffer(); sigBuffer.append("api_key=" + api_key); sigBuffer.append("call_id=" + call_id); sigBuffer.append("method=" + method); sigBuffer.append("nonce=" + nonce); sigBuffer.append("session_key=" + sessionKey); sigBuffer.append("v=" + v); sigBuffer.append(sessionSecret); MessageDigest md = MessageDigest.getInstance("MD5"); md.update(sigBuffer.toString().getBytes()); byte[] digest = md.digest(); StringBuffer sig = new StringBuffer(); for (int i = 0; i &lt; digest.length; ++i) { sig.append(Integer.toHexString(0xFF &amp; digest[i])); } StringBuffer response = new StringBuffer(); response.append("api_key=" + URLEncoder.encode(api_key)); response.append("&amp;call_id=" + URLEncoder.encode(call_id)); response.append("&amp;method=" + URLEncoder.encode(method)); response.append("&amp;nonce=" + URLEncoder.encode(nonce)); response.append("&amp;session_key=" + URLEncoder.encode(sessionKey)); response.append("&amp;v=" + URLEncoder.encode(v)); response.append("&amp;sig=" + URLEncoder.encode(sig.toString())); StringBuilder out = new StringBuilder(); out.append("&lt;response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'&gt;"); out.append(Base64.encodeToString(response.toString().getBytes(), Base64.NO_WRAP)); out.append("&lt;/response&gt;"); writer.write(out.toString()); writer.flush(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload