nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches

◆ nrf_cloud_jwt_generate()

int nrf_cloud_jwt_generate ( uint32_t  time_valid_s,
char *const  jwt_buf,
size_t  jwt_buf_sz 
)

#include <include/net/nrf_cloud.h>

Generate a JWT to be used with nRF Cloud's REST API. This library's configured values for client id and sec tag (NRF_CLOUD_SEC_TAG) will be used for generating the JWT.

Parameters
[in]time_valid_sHow long (seconds) the JWT will be valid. Maximum duration specified by NRF_CLOUD_JWT_VALID_TIME_S_MAX. If zero, NRF_CLOUD_JWT_VALID_TIME_S_DEF will be used.
[in,out]jwt_bufBuffer to hold the JWT.
[in]jwt_buf_szSize of the buffer (recommended size >= 600 bytes).
Return values
0JWT generated successfully.
-ETIMEModem does not have valid date/time, JWT not generated.
Returns
A negative value indicates an error.