OAuth instance state in Android

后端 未结 6 1143
眼角桃花
眼角桃花 2020-12-08 08:49

I\'m trying to use OAuth in an Android app. I have it working correctly but have sometimes run into a problem during the authentication phase. In Android, I launch the brows

6条回答
  •  -上瘾入骨i
    2020-12-08 09:15

    You only need to persist consumer.getToken() and consumer.getTokenSecret()

    Later you can simply recreate a new consumer(customerKey,customerKeySecret) and consumer.setTokenWithSecret(token, tokenSecret)

    What was tricky is to find out was the following:

    1. Use CommonsHttpOAuthConsumer and CommonsHttpOAuthProvider (on android) the DefaultOAuthProvider will not work.

    2. When using HttpURLConnection, you cannot sign POST requests that carry query parameters in the message payload

提交回复
热议问题