Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8677615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:30:19+00:00 2026-06-12T20:30:19+00:00

I am trying to implement Facebook SSO in my android app.It opens native Facebook

  • 0

I am trying to implement Facebook SSO in my android app.It opens native Facebook app, after login process complete it shows “500: internal server error”.What I am doing wrong?

Any suggestion will be highly appreciated .
Here is my code

public class FacebookUtil {

    public static Facebook facebook = new Facebook(AppConstants.FACEBOOK_APP_ID);
    String FILENAME = "AndroidSSO_data";
    private static SharedPreferences mPrefs;
    private static Context mContext;
    private static  boolean isSucess;
    private static FacebookSucessListener mFacebookSucessListener;
     public static final String FB_APP_SIGNATURE ="xxxxxxxxxxxxxxxxxxx"; 
    public interface FacebookSucessListener {
        public void onSucess(boolean isSucess);
    }
    public static void postToWall(){
        facebook.dialog(mContext, "feed" , new DialogListener(){
            public void onCancel() {

            }
            public void onComplete(Bundle arg0) {

            }

            public void onError(DialogError arg0) {

            }

            public void onFacebookError(FacebookError arg0) {

            }});
    }

    /*
     * Function to update status
     * @param facebook acesstoken acess token
     * @param  String message to post
     */
    public static void updateStatus(String accessToken, final String aMsgToShare){
        try {
            Bundle bundle = new Bundle();
            bundle.putString("message", aMsgToShare);
            bundle.putString(Facebook.TOKEN, accessToken);
            String response = facebook.request("me/feed",bundle,"POST");
            if(response.contains("Duplicate status message"))
                Toast.makeText(mContext, "Duplicate message can not post", Toast.LENGTH_SHORT).show();
            else if (response.contains("The user hasn't authorized the application to perform this action"))
                Toast.makeText(mContext, "The user hasn't authorized the application to perform this action",Toast.LENGTH_SHORT).show();
            else
                Toast.makeText(mContext,"Posted Successfuly", Toast.LENGTH_SHORT).show();
        } catch (MalformedURLException e) {
            Log.e("MALFORMED URL",""+e.getMessage());

        } catch (IOException e) {

        }
    }
    /*
     * To logout from facebook
     * @param Activity activity
     * return response
     */
    public static String logoutFacebook(Activity aActivity){
        String resonse = "";
        try {
            String response = facebook.logout(aActivity.getApplicationContext());
        } catch (Exception e) {
            Log.e("LogoutException",""+e.getMessage());
        }
        return resonse;
    }


    /*
     * TO start the  facebook login process
     * @param Activity activity
     * @param SharedPreferences pref
     * return true in case of sucess false otherwise
     */
    public static void startLoginProcess(final Activity aActivity,final SharedPreferences mPrefs,FacebookSucessListener facebookSucessListener)
    {
        try{
            mFacebookSucessListener = facebookSucessListener;
        }catch(Exception e){}

        /*
         * Get existing access_token if any
         */
        mContext=aActivity;
        String access_token = mPrefs.getString("fb_access_token", null);
        long expires = mPrefs.getLong("fb_expire_time", 0);
        if(access_token != null) {
            facebook.setAccessToken(access_token);
        }
        if(expires != 0) {
            facebook.setAccessExpires(expires);
        }
        boolean isSessionValid  = facebook.isSessionValid();
        if(!isSessionValid)
        {
            //Facebook.FORCE_DIALOG_AUTH
            facebook.authorize( aActivity, AppConstants.permissions, 1, new DialogListener() {
                public void onComplete(Bundle values) {
                    String token = values.getString(Facebook.TOKEN);
                    SharedPreferences.Editor editor = mPrefs.edit();
                    editor.putString("fb_access_token", facebook.getAccessToken());
                    editor.putLong("fb_expire_time", facebook.getAccessExpires());
                    editor.putBoolean("is_fb_logged_in", true);
                    editor.commit();
                    mFacebookSucessListener.onSucess(true);
                }

                public void onFacebookError(FacebookError error) {
                    mFacebookSucessListener.onSucess(false);
                    Log.e("Facebook-onFacebookError", error.getMessage());
                    Toast.makeText(aActivity, "Error: "+ error.getMessage(), 600).show();
                }
                public void onError(DialogError e) {
                    mFacebookSucessListener.onSucess(false);
                    Log.e("Facebook-onError", e.getMessage());
                    Toast.makeText(aActivity, "Error: "+ e.getMessage(), 600).show();

                }

                public void onCancel() {

                }
            });
        }
        else {
            mFacebookSucessListener.onSucess(true);
        }


    }
    final class PostDialogListener implements DialogListener {
        public void onComplete(Bundle values) {

        }

        public void onFacebookError(FacebookError error) {
            Log.e("Facebook-onFacebookError", error.getMessage());
        }

        public void onError(DialogError error) {
            Log.e("Facebook-onFacebookError", error.getMessage());
        }

        public void onCancel() {

        }
    }


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:30:21+00:00Added an answer on June 12, 2026 at 8:30 pm

    Finally I solved my problem.The Has key, I was generating through CMD in window 7, was wrong.
    So I generated this programmatically.

    private void getHashKey()
    {
            PackageInfo info;
            try {
            info = getPackageManager().getPackageInfo("your app package name", PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                       MessageDigest md;
            md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
                       //String something = new String(Base64.encode(md.digest(), 0));
                         String something = new String(Base64.encode(md.digest(),0));
                       Log.e("**** Hash Key", something);
            } 
            }
            catch (NameNotFoundException e1) {
            Log.e("name not found", e1.toString());
            }
    
            catch (NoSuchAlgorithmException e) {
            Log.e("no such an algorithm", e.toString());
            }
            catch (Exception e){
            Log.e("exception", e.toString());
            }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to implement a login with facebook/twitter functionality in my app, i read
I am trying to implement facebook login and wall post in Android, so I
i am trying to implement the facebook connect on my iphone App. after the
I'm trying to implement the Facebook SDK (3.0 beta) in an Android app that
I am trying to implement Facebook into my Android app. Everytime though, the facebook
Hi i was trying to implement facebook login for my django app using django-facebook
I am trying implement a photo gallery similar to facebook in Android. I was
I'm trying to implement single sign-on using facebook in my ruby sinatra app. So
I am trying to implement Facebook Login functionality to my website. I followed the
I am trying to implement facebook like functionality using android webview. It is working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.