TwitterException: 401:Authentication credentials were missing or incorrect

Hi Community,
I researched for a few days now to find the solution myself but actually didn’t succeed:
When trying to authenticate openHAB against Twitter, the following error is printed to the log, a few seconds after the URL was printed to the log.

The machine is running openhab 1.7.1installed with apt-get

[ERROR] [o.o.a.t.i.TwitterActionService] - Failed to authenticate openHAB against Twitter
twitter4j.TwitterException: 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.
Error processing your OAuth request: Invalid oauth_verifier parameter

	at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:162) ~[twitter4j-core-3.0.5.jar:3.0.5]
	at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61) ~[twitter4j-core-3.0.5.jar:3.0.5]
	at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:98) ~[twitter4j-core-3.0.5.jar:3.0.5]
	at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:145) ~[twitter4j-core-3.0.5.jar:3.0.5]
	at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:165) ~[twitter4j-core-3.0.5.jar:3.0.5]
	at twitter4j.TwitterBaseImpl.getOAuthAccessToken(TwitterBaseImpl.java:381) ~[twitter4j-core-3.0.5.jar:3.0.5]
	at org.openhab.action.twitter.internal.TwitterActionService.getAccessToken(TwitterActionService.java:164) [bundlefile:na]
	at org.openhab.action.twitter.internal.TwitterActionService.start(TwitterActionService.java:104) [bundlefile:na]
	at org.openhab.action.twitter.internal.TwitterActionService.updated(TwitterActionService.java:253) [bundlefile:na]
	at org.eclipse.equinox.internal.cm.ManagedServiceTracker$1.run(ManagedServiceTracker.java:183) [org.eclipse.equinox.cm_1.0.400.v20120522-1841.jar:na]
	at org.eclipse.equinox.internal.cm.SerializedTaskQueue$1.run(SerializedTaskQueue.java:36) [org.eclipse.equinox.cm_1.0.400.v20120522-1841.jar:na]

Any Advices on how to get Twitter authenticated or hints what I might have done wrong?
Thanks a lot!

okay, was a stupid mistake. Didn’t delete the old twitter.pin File of an earlier attempt.

Initial Problem was: /etc/twitter.token could not be written cause of
java.io.FileNotFoundException: etc/twitter.token (Permission denied)

So I changed User in /etc/default/openhab to root:root for the Twitter authentication process and afterwards back to my openhab user.

Is this the common procedure. And if it’s so - wouldn’t it be a great idea to note this in the Wiki? :smiley: