Hi Jason,

Device does not require a username/password to refresh the token rather it
requires a client Id and client secret[1]. For our sample use cases we can
either create a clientId and client secret per device or per device type.
In the raspberry pi example the client information will be embedded in the
script. Therefore the access token for device can renewed with the client
information and refresh token.

[1] https://docs.wso2.com/display/IS510/Refresh+Token+Grant

Thanks,
Ayyoob

*Ayyoob Hamza*
*Software Engineer*
WSO2 Inc.; http://wso2.com
email: ayy...@wso2.com cell: +94 77 1681010 <%2B94%2077%207779495>

On Fri, Aug 5, 2016 at 8:07 AM, 云展智创 <i...@smartcloudex.com> wrote:

> Hi Ayyoob,
>
> Thanks. I am testing to change the AccessTokenDefaultValidityPeriod to
> 84600 seconds (about one day). I want to confirm with you whether my
> understanding of the following configuration attributes is correct.
>
> <AuthorizationCodeDefaultValidityPeriod> is used when user login in the
> application and get the client_id and client_secret, the application need
> to request for Refresh token and Access token in 300 seconds.
>
> <AccessTokenDefaultValidityPeriod> is used for setting up the validity
> period for device agent access token. After 3600 seconds, the device agent
> CAN NOT access IoTS with the old Access token.
>
> <UserAccessTokenDefaultValidityPeriod> is used for setting up the
> validity period for user access token from UI.
>
> <RefreshTokenValidityPeriod> is used for setting up the validity period
> for Refresh token. That’s means, after 84600 seconds, users need to login
> again to get the new refresh token. *But how does the device get the new
> Refresh token as it can not login with username/password and the old
> refresh token is expired?*
>
> =================
> <!-- Default validity period for Authorization Code in seconds -->
>         <AuthorizationCodeDefaultValidityPeriod>300</
> AuthorizationCodeDefaultValidityPeriod>
>         <!-- Default validity period for user access tokens in seconds -->
>         <AccessTokenDefaultValidityPeriod>3600</
> AccessTokenDefaultValidityPeriod>
>         <!-- Default validity period for application access tokens in
> seconds -->
>         <UserAccessTokenDefaultValidityPeriod>3600</
> UserAccessTokenDefaultValidityPeriod>
>         <!-- Validity period for refresh token -->
>         <RefreshTokenValidityPeriod>84600</RefreshTokenValidityPeriod>
> ====================
>
> ------
> Zhanwen Zhou (Jason)
> +86 13922218435
> zhanwen.z...@smartcloudex.com
> Guangzhou Smart Cloudex Technology Co., Ltd.
> Business: API Management, IoT
>
> On Aug 5, 2016, at 9:39 AM, Ayyoob Hamza <ayy...@wso2.com> wrote:
>
> Hi Jason,
>
> This happens when the OAuth token is expired for the device. In the IoTS
> alpha we have not implemented the renewing the token with refresh token
> part, however this has been implemented in the master. One way of having a
> continuous connection for the samples in alpha pack would be to increase
> the expiration time in identity.xml (repository/conf/identity/
> identity.xml).
>
> Thanks,
> Ayyoob
>
> *Ayyoob Hamza*
> *Software Engineer*
> WSO2 Inc.; http://wso2.com
> email: ayy...@wso2.com cell: +94 77 1681010 <%2B94%2077%207779495>
>
> On Fri, Aug 5, 2016 at 6:45 AM, 云展智创 <i...@smartcloudex.com> wrote:
>
>> I got the following error logs from IoTS:
>>
>> ==============
>> [2016-08-05 08:57:06,466] ERROR - MessageMetricsHandler Connection reset
>> by peer
>> java.io.IOException: Connection reset by peer
>> at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
>> at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
>> at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>> at sun.nio.ch.IOUtil.read(IOUtil.java:192)
>> at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
>> at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(Unpoole
>> dUnsafeDirectByteBuf.java:446)
>> at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:881)
>> at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(Nio
>> SocketChannel.java:225)
>> at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.
>> read(AbstractNioByteChannel.java:119)
>> at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEven
>> tLoop.java:511)
>> at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimiz
>> ed(NioEventLoop.java:468)
>> at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEve
>> ntLoop.java:382)
>> at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
>> at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(
>> SingleThreadEventExecutor.java:116)
>> at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnabl
>> eDecorator.run(DefaultThreadFactory.java:137)
>> at java.lang.Thread.run(Thread.java:745)
>> [2016-08-05 08:57:06,480]  INFO - ProtocolProcessor Lost connection with
>> client paho/551D5528F7972AE4CD
>> [2016-08-05 08:57:06,484]  INFO - MQTTopicManager Disconnecting channel
>> for clientID: paho/551D5528F7972AE4CD
>> [2016-08-05 08:57:06,529]  INFO - SubscriptionEngine Local Subscription
>> DELETED [carbon.super/raspberrypi/s4mbetlzspyc]ID=carbon:paho/551D55
>> 28F7972AE4CD:carbon.super/raspberrypi/s4mbetlzspyc@NODEZhanw
>> endeMacBook-Air.local/192.168.0.102/T=1470358626484/D=false/
>> X=true/O=/E=amq.topic/ET=/EUD=1/S=false
>> [2016-08-05 08:57:06,529]  INFO - OrphanedMessageHandler Purging messages
>> of this node persisted under carbon.super/raspberrypi/s4mbetlzspyc
>> [2016-08-05 08:57:06,540]  INFO - MessagingEngine Purged messages of
>> destination carbon.super/raspberrypi/s4mbetlzspyc
>> [2016-08-05 08:57:07,775]  INFO - ProtocolProcessor Lost connection with
>> client paho/551D5528F7972AE4CD
>> [2016-08-05 08:57:07,776]  WARN - ProtocolProcessor
>> MQTTAuthorizationSubject for client ID paho/551D5528F7972AE4CD is not
>> removed since the entry does not exist
>> [2016-08-05 08:57:08,795]  INFO - ProtocolProcessor Lost connection with
>> client paho/551D5528F7972AE4CD
>> [2016-08-05 08:57:08,795]  WARN - ProtocolProcessor
>> MQTTAuthorizationSubject for client ID paho/551D5528F7972AE4CD is not
>> removed since the entry does not exist
>> [2016-08-05 08:57:09,810]  INFO - ProtocolProcessor Lost connection with
>> client paho/551D5528F7972AE4CD
>> ……
>> ==============
>>
>> ------
>> Zhanwen Zhou (Jason)
>> +86 13922218435
>> zhanwen.z...@smartcloudex.com
>> Guangzhou Smart Cloudex Technology Co., Ltd.
>> Business: API Management, IOT
>>
>> On Aug 4, 2016, at 10:23 AM, 云展智创 <i...@smartcloudex.com> wrote:
>>
>> Hi all,
>>
>> I downloaded a raspberry pi agent from IoTS 1.0.0 alpha, ran the
>> raspberry pi agent and uploaded the temperature data successfully. But
>> after I disconnected the agent for a while, the MQTT connection could not
>> be setup again. Can anyone help me for this? Thanks.
>>
>> ————
>> MQTT_LISTENER: Connected with result code 4
>> MQTT_LISTENER: Subscribing with topic carbon.super/raspberrypi/rkwrk
>> lcphsmu
>> ————
>>
>> ------
>> Zhanwen Zhou (Jason)
>> +86 13922218435
>> zhanwen.z...@smartcloudex.com
>> Guangzhou Smart Cloudex Technology Co., Ltd.
>> Business: API Management, IOT
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to