Announcement Announcement Module
Collapse
No announcement yet.
OAuth authentication failed: Unauthorized Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • OAuth authentication failed: Unauthorized

    I'm trying to add integration with twitter and got error - "OAuth authentication failed: Unauthorized" for getting request token.
    my config:
    Code:
    <bean id="protectedResourceDetailsService" class="org.springframework.security.oauth.consumer.InMemoryProtectedResourceDetailsService">
    		<property name="resourceDetailsStore">
    			<map>
    				<entry key="linkedInResources" value-ref="linkedInResources"/>
    				<entry key="twitterResources" value-ref="twitterResources"/>
    			</map>
    		</property>
    	</bean>
    	
    	<bean id="linkedInResources" class="org.springframework.security.oauth.consumer.BaseProtectedResourceDetails">
    		<property name="id" value="linkedInResources"/>
    		<property name="consumerKey" value="${linkedin.key.public}"/>
    		<property name="sharedSecret">
    			<bean class="org.springframework.security.oauth.common.signature.SharedConsumerSecret">
    				<constructor-arg value="${linkedin.key.private}"/>
    			</bean>
    		</property>
    		<property name="requestTokenURL" value="https://api.linkedin.com/uas/oauth/requestToken"/>
    		<property name="accessTokenURL" value="https://api.linkedin.com/uas/oauth/accessToken"/>
    		<property name="userAuthorizationURL" value="https://www.linkedin.com/uas/oauth/authorize"/>
    		<property name="signatureMethod" value="HMAC-SHA1"/>
    	</bean>
    
    	<bean id="twitterResources" class="org.springframework.security.oauth.consumer.BaseProtectedResourceDetails">
    		<property name="id" value="twitterResources"/>
    		<property name="consumerKey" value="${twitter.key.public}"/>
    		<property name="sharedSecret">
    			<bean class="org.springframework.security.oauth.common.signature.SharedConsumerSecret">
    				<constructor-arg value="${twitter.key.private}"/>
    			</bean>
    		</property>
    		<property name="requestTokenURL" value="http://api.twitter.com/oauth/request_token"/>
    		<property name="accessTokenURL" value="http://api.twitter.com/oauth/access_token"/>
    		<property name="userAuthorizationURL" value="http://api.twitter.com/oauth/authorize"/>
    		<property name="signatureMethod" value="HMAC-SHA1"/>
    	</bean>
    As you can see, I've already implemented linkedIn integration, using same config and everything works fine. But I don't understand why it doesn't work with twitter

  • #2
    I found out, what is wrong. Problem with my twitter application. Looks like it just doesn't work until you specify url callback in app profile. But it is optional and I always override callback in all my requests by another value. It looks like a bug in twitter api.

    Comment

    Working...
    X