huuanh1987 / facebook-java-api

Automatically exported from code.google.com/p/facebook-java-api
0 stars 0 forks source link

Creating Signature fails #233

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Map<String, String> entries = new HashMap<String, String>();
            entries.put("api_key", apiKey);
            entries.put("v", "1.0");
            entries.put("auth_token", token);
            entries.put("method", "Photos.createAlbum");
            // Convert the map to a list

            List<String> params = 
FacebookSignatureUtil.convert(entries
                    .entrySet());

            // Sort the list

            Collections.sort(params);

            // Concatenate params for URL encoding (to generate 
a URL)

            String paramURLEncoded = "";

            for (String param : params) {

                // Don't add an ampersand if it's the first 
param

                if (paramURLEncoded == "") {

                    paramURLEncoded = paramURLEncoded + 
param;

                }

                // Add an ampersand

                else {

                    paramURLEncoded = paramURLEncoded + 
"&" + param;

                }

            }

            // Generate the signature with the sorted list of 
params

            String generatedSignature = FacebookSignatureUtil
                    .generateSignature(params, secret);
            System.out.println("Generated Signature: " + 
generatedSignature);
         System.out.println(FacebookSignatureUtil.verifySignature(entries,

this always returns false.Am i doing some thing wrong while creating the 
signature

Original issue reported on code.google.com by jayanths...@gmail.com on 25 Aug 2009 at 4:52

GoogleCodeExporter commented 8 years ago
i need it urgently guys!!

Original comment by jayanths...@gmail.com on 25 Aug 2009 at 5:04

GoogleCodeExporter commented 8 years ago
i have got a solution !!

Original comment by intutest...@gmail.com on 26 Aug 2009 at 6:27

GoogleCodeExporter commented 8 years ago
Err... so glad you posted.

Original comment by david.j....@googlemail.com on 28 Aug 2009 at 10:17