Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oauth_consumer.properties not found #56

Closed
saqueib opened this issue Mar 7, 2015 · 3 comments
Closed

oauth_consumer.properties not found #56

saqueib opened this issue Mar 7, 2015 · 3 comments

Comments

@saqueib
Copy link

saqueib commented Mar 7, 2015

I am using SocialAuth library for auth user with Facebook, Twitter and Google. I have some Questions.

I am getting below error in log cat

D/SocialAuthAdapter﹕ Selected provider is facebook
D/SocialAuthAdapter﹕ Loading keys and secrets from configuration
D/SocialAuthAdapter﹕ oauth_consumer.properties not found
D/SocialAuthAdapter﹕ Could not load configuration
D/SocialAuthAdapter﹕ Starting webview for authentication
D/SocialAuthError﹕ org.brickred.socialauth.exception.SocialAuthConfigurationException: SocialAuth configuration is null.
E/Login activity﹕ URL Authentication error

Below is my folder structure

enter image description here

My LoginActivity.java

public class LoginActivity extends ActionBarActivity {

private SocialAuthAdapter adapter;

//Android Component
private Button fb_button, tw_button, g_button;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().hide();
    setContentView(R.layout.activity_login);

    //Social Adapter
    adapter = new SocialAuthAdapter(new DialogListener() {
        @Override
        public void onComplete(Bundle bundle) {
            adapter.getUserProfileAsync(new SocialAuthListener<Profile>() {
                @Override
                public void onExecute(String s, Profile profile) {
                    Log.e("Custom UI", "Login Receiving Data");
                    Profile profileMap = profile;
                    Log.d("Custom-UI",  "Validate ID         = " + profileMap.getValidatedId());
                    Log.d("Custom-UI",  "First Name          = " + profileMap.getFirstName());
                    Log.d("Custom-UI",  "Last Name           = " + profileMap.getLastName());
                    Log.d("Custom-UI",  "Email               = " + profileMap.getEmail());
                    Log.d("Custom-UI",  "Gender              = " + profileMap.getGender());
                    Log.d("Custom-UI",  "Country             = " + profileMap.getCountry());
                    Log.d("Custom-UI",  "Language            = " + profileMap.getLanguage());
                    Log.d("Custom-UI",  "Location            = " + profileMap.getLocation());
                    Log.d("Custom-UI",  "Profile Image URL   = " + profileMap.getProfileImageURL());
                }

                @Override
                public void onError(SocialAuthError socialAuthError) {
                    Log.e("Custom UI", "Profile Data Error");
                }
            });
        }

        @Override
        public void onError(SocialAuthError socialAuthError) {
            Log.e("Login activity", socialAuthError.getMessage());
        }

        @Override
        public void onCancel() {

        }

        @Override
        public void onBack() {

        }
    });


    //Wire up the Login Buttons
    fb_button = (Button) findViewById(R.id.buttonFB);
    tw_button = (Button) findViewById(R.id.buttonTwitter);
    g_button = (Button) findViewById(R.id.buttonGoogle);

    //Event Listener for Click

    //Facebook
    fb_button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            adapter.authorize(LoginActivity.this, SocialAuthAdapter.Provider.FACEBOOK);
            Toast.makeText(LoginActivity.this, "I am Facebook", Toast.LENGTH_SHORT).show();
        }
    });

    //Twitter
    tw_button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            adapter.addCallBack(SocialAuthAdapter.Provider.TWITTER,"http://domain.com/auth/twitter");
            adapter.authorize(LoginActivity.this, SocialAuthAdapter.Provider.TWITTER);
            Toast.makeText(LoginActivity.this, "I am Twitter", Toast.LENGTH_SHORT).show();
        }
    });

    //Google
    g_button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            adapter.addCallBack(SocialAuthAdapter.Provider.GOOGLE,"http://domain.com/google");
            adapter.authorize(LoginActivity.this, SocialAuthAdapter.Provider.GOOGLE);
            Toast.makeText(LoginActivity.this, "I am Google", Toast.LENGTH_SHORT).show();
        }
    });

  }

}

Some more doubts

What will be use of callback url in app. what will be posted at callback url?

How can I show this login screen only first time ?

One way will be SharedPreference to store the settings of user logged in, is there any way in SocialAuth library to do this.

Thanks for this Library its great but documentation can be improved.

I am getting below error in log cat, its saying not able to load the oauth_consumer.properties

Here is full question on StackOverflow

@saqueib saqueib changed the title oauth_consumer.properties not found social auth android oauth_consumer.properties not found Mar 7, 2015
@saqueib
Copy link
Author

saqueib commented Mar 7, 2015

After banging my head for full 2 days i found the error

You need to put the assets folder on same level as 'res' folder in order to load the oauth_consumer.properties file.

src
    main
       assets
       java
       res
       AndroidManifest.xml

I just need below doubts to clear if you guys can help

What will be use of callback url in app. what will be posted at callback url?

How can I show this login screen only first time ?

One way will be SharedPreference to store the settings of user logged in, is there any way in SocialAuth library to do this.

@vikrantkjain
Copy link

yahoo returning null in firstname ,last name, email ,dob
adapter.getUserProfileAsync(new SocialAuthListener() {
@OverRide
public void onExecute(String s, Profile profile) {
Log.e("Custom UI", "Login Receiving Data");
Profile profileMap = profile;
Log.d("Custom-UI", "Validate ID = " + profileMap.getValidatedId());
Log.d("Custom-UI", "First Name = " + profileMap.getFirstName());
Log.d("Custom-UI", "Last Name = " + profileMap.getLastName());
Log.d("Custom-UI", "Email = " + profileMap.getEmail());
Log.d("Custom-UI", "Gender = " + profileMap.getGender());
Log.d("Custom-UI", "Country = " + profileMap.getCountry());
Log.d("Custom-UI", "Language = " + profileMap.getLanguage());
Log.d("Custom-UI", "Location = " + profileMap.getLocation());
Log.d("Custom-UI", "Profile Image URL = " + profileMap.getProfileImageURL());
}

            @Override
            public void onError(SocialAuthError socialAuthError) {
                Log.e("Custom UI", "Profile Data Error");
            }
        });    

@sayantam
Copy link
Collaborator

Looks like the original issue was self-solved. @vikrantkjain please log a new issue if you are still having problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants