Can’t connect to Brand Portal by replication agent as “JWT has expired” | AEM | Brand Portal

Description

Issue
After configuration of Integration with Brand Portal by 1, “Test Connection” on the agent return the error with 2 messages.

1 Configuring AEM Assets integration with Brand Portal
https://experienceleague.adobe.com/docs/experience-manager-65/assets/brandportal/configure-aem-assets-with-brand-portal.html?lang=en

2 Test connection fail message

28.02.2017 18:39:51 - INFO - mp_replication_agent_default_bpsupportapac : Using user mac-bpsupportapac-replication for building content.
28.02.2017 18:39:51 - INFO - mp_replication_agent_default_bpsupportapac : Creating content for path /content
28.02.2017 18:39:51 - INFO - mp_replication_agent_default_bpsupportapac : Create new HttpClient for bpsupportapac MP Replication Agent Default
28.02.2017 18:39:51 - INFO - mp_replication_agent_default_bpsupportapac : * HTTP Version: 1.1
28.02.2017 18:39:51 - INFO - mp_replication_agent_default_bpsupportapac : * Using OAuth 2.0 Authorization Grants
28.02.2017 18:39:51 - INFO - mp_replication_agent_default_bpsupportapac : * OAuth 2.0 User: mac-bpsupportapac-replication
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac : Failed to get an access token for user: mac-bpsupportapac-replication msg: failed to get access token from authorization server status: 400 response: {"error":"invalid_grant","error_description":"JWT has expired"}
28.02.2017 18:39:51 - INFO - mp_replication_agent_default_bpsupportapac : Sending POST request to https://bpsupportapac.brand-portal.adobe.com/bin/receive?sling:authRequestLogin=1
28.02.2017 18:39:51 - INFO - mp_replication_agent_default_bpsupportapac : sent. Response: 401 Unauthorized
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac : Replication (TEST) of /content not successful. Conversation follows
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac : ------------------------------------------------
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac : Sending message to bpsupportapac.brand-portal.adobe.com:-1
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  POST /bin/receive HTTP/1.0
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Action: Test
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Path: /content
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Handle: /content
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Referer: about:blank
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Content-Length: 0
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Content-Type: application/octet-stream
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac : --
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  HTTP/1.1 401 Unauthorized
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Date: Fri, 03 Mar 2017 04:29:05 GMT
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Server: Apache/2.4.10 (Unix) Communique/4.2.1
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  WWW-Authenticate: Basic realm="Sling (Development)"
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  X-Frame-Options: SAMEORIGIN
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  X-XSS-Protection: 1; mode=block; report=https://service.brand-portal.adobe.com/security-bugs/log/mac
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Content-Security-Policy: default-src 'self' https://*.adobe.com https://*.assetsadobe.com http://*.assetsadobe.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.brand-portal.adobe.com https://brand-portal.adobe.com https://*.marketing.adobe.com https://marketing.adobe.com https://use.typekit.net https://*.tt.omtrdc.net https://*.services.adobe.com https://*.adobelogin.com https://*.adobemc.com https://*.scene7.com https://assets.adobedtm.com https://*.guided.ss-omtrdc.net https://*.omniture.com https://*.demandbase.com; style-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.brand-portal.adobe.com https://brand-portal.adobe.com https://*.marketing.adobe.com https://marketing.adobe.com https://use.typekit.net https://*.tt.omtrdc.net https://*.guided.ss-omtrdc.net https://*.omniture.com https://*.scene7.com; img-src * data: ; font-src * data: ; frame-src 'self' https://*.brand-portal.adobe.com https://*.marketing.adobe.com https://*.omniture.com https://*.services.adobe.com https://services.adobe.com https://*.adobelogin.com; object-src 'self' https://*.scene7.com http://*.assetsadobe.com https://*.assetsadobe.com; report-uri https://service.brand-portal.adobe.com/security-bugs/log/mac
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Timing-Allow-Origin: https://*.brand-portal.adobe.com/
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Set-Cookie: renderid=rend2; path=/;Secure
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Vary: User-Agent,Accept-Encoding
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :  Content-Length: 0
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac :
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac : Message sent.
28.02.2017 18:39:51 - ERROR - mp_replication_agent_default_bpsupportapac : ------------------------------------------------
28.02.2017 18:39:51 - INFO - mp_replication_agent_default_bpsupportapac : Replication (TEST) of /content not successful.

Environment
AEM 6.2 with Brand Portal
Cause
Time difference between AEM instance and Brand Portal cloud.
The difference cause the expire the JWT.
Specified Message
Failed to get an access token
JWT has expired

Resolution

Confirm the OS time of AEM.
Change the time to valid time or use ntp.

On this page