Skip to content

Commit

Permalink
GCP, Azure: Warn if time is not set
Browse files Browse the repository at this point in the history
CL: none

PUBLISHED_FROM=a67a0b8e3a8c7720ddac7f32685cd1b0b459b987
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Apr 18, 2018
1 parent 99bd8e0 commit 57db14f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mgos_gcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ static void mgos_gcp_mqtt_connect(struct mg_connection *c,
base64url_putc('.', &ctx);
uint64_t iat = (uint64_t) now;
uint64_t exp = iat + mgos_sys_config_get_gcp_token_ttl();
if (exp < 1500000000) {
LOG(LL_ERROR, ("Time is not set, GCP connection will fail. "
"Set the time or make sure SNTP is enabled and working."));
}
cs_base64_init(&ctx.b64_ctx, base64url_putc, &ctx);
json_printf(&out, "{aud:%Q,iat:%llu,exp:%llu}",
mgos_sys_config_get_gcp_project(), iat, exp);
Expand Down

0 comments on commit 57db14f

Please sign in to comment.