Mantaz
Mantaz

Reputation: 480

How to do Authentication in Pinterest SDK for Android

I am reading Pinterest Android documentation on how to implement Pinterest SDK into Android app : https://developers.pinterest.com/docs/sdks/android/? Stuck on authentication.

This example is presented.

But how to use it? How to declare pdkClient variable?

If I making it static, PDKClient.login method yelling "Non-static method ..." and new PDKCallback() yelling: "Cannot access com.android.volley.Response.Listener"

List scopes = new ArrayList<String>();
    scopes.add(PDKClient.PDKCLIENT_PERMISSION_READ_PUBLIC);
    scopes.add(PDKClient.PDKCLIENT_PERMISSION_WRITE_PUBLIC);

pdkClient.login(this, scopes, new PDKCallback() {
    @Override
    public void onSuccess(PDKResponse response) {
        Log.d(getClass().getName(), response.getData().toString());
        //user logged in, use response.getUser() to get PDKUser object
    }

    @Override
    public void onFailure(PDKException exception) {
        Log.e(getClass().getName(), exception.getDetailMessage());
    }
});

Upvotes: 0

Views: 122

Answers (1)

Warrocker
Warrocker

Reputation: 752

There is a mistake in the tutorial, you can use it like this PdkClient.getInstance().login(... after you initialize client, or you can store initialized instance above

Upvotes: 1

Related Questions