Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

java.lang.NullPointerException: No authentication header information #467

Open
gurmeetsingh90 opened this issue Dec 26, 2016 · 0 comments
Open

Comments

@gurmeetsingh90
Copy link

gurmeetsingh90 commented Dec 26, 2016

` private void setOauthParameter() {
GoogleOAuthParameters oauthParam = new GoogleOAuthParameters();
oauthParam.setOAuthConsumerKey(ClientId);
oauthParam.setOAuthConsumerSecret(ClientSecrate);
oauthParam.setOAuthType(OAuthParameters.OAuthType.TWO_LEGGED_OAUTH);
// Init the service and set the auth
service = new ContactsService("chat.com.contactssharing");
try {
service.setOAuthCredentials(oauthParam, new OAuthHmacSha1Signer());

        service.getRequestFactory().setHeader("User-Agent", "chat.com.contactssharing");

    } catch (OAuthException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

private void queryEntries() throws IOException, ServiceException {
Query myQuery = new Query(feedUrl);
myQuery.setMaxResults(50);
myQuery.setStartIndex(1);
myQuery.setStringCustomParameter("showdeleted", "false");
myQuery.setStringCustomParameter("requirealldeleted", "false");
myQuery.setStringCustomParameter("sortorder", "ascending");

   try {
             // Execution of this line i'm getting an exception
        ContactFeed resultFeed = (ContactFeed) this.service.query(myQuery, ContactFeed.class);
        Log.d(TAG, resultFeed.toString());
        for (ContactEntry entry : resultFeed.getEntries()) {
            printContact(entry);
        }
        System.err.println("Total: " + resultFeed.getEntries().size() + " entries found");

    } catch (Exception ex) {
        System.err.println("Not all placehorders of deleted entries are available");
    }

}

`

I have check no's of post for this Exception but no one is commented by correct solution.It's become blocker for me so please help me to out this problem and guide what is doing wrong at above code.

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

No branches or pull requests

1 participant