--- title: "JSON Web Tokens" slug: "json-web-tokens" tags: ["PCA", "analytics 21.06", "web token", "API", "JSON"] updated: 2026-11-06T20:53:22Z published: 2026-11-06T20:53:22Z canonical: "docs.crossworkassurance.cisco.com/json-web-tokens" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.crossworkassurance.cisco.com/llms.txt > Use this file to discover all available pages before exploring further. # JSON Web Tokens For secure machine-to-machine integration, avoid embedding login credentials in scripts. Instead, use JSON Web Tokens (JWTs). If you are unfamiliar with JSON Web Tokens (JWTs), consider reviewing [Wikipedia JSON article](https://en.wikipedia.org/wiki/JSON_Web_Token) or visiting [JWT.io](https://jwt.io/) for further information. JWT administration is conducted via APIs. Refer to our [API page](https://api.accedian.io/session.html) for the Swagger file and specifications. --- ## Step 1: Login with Curl Method Use curl to log into Crosswork Assurance (formerly Skylight Analytics), capturing the authentication token with the -v parameter for subsequent use: ``` curl --location --request POST 'https:///api/v1/auth/login' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'username=you@yourdomain.com' \ --data-urlencode 'password=yourpassword' -v ``` The result will be verbose due to the -v parameter, but look for the authorization header: ``` ... < HTTP/2 200 ... < authorization: Bearer MTYyNDU4NzYgG17D3sci8L ... ``` Locate the authentication token in the response, following the 'Bearer' keyword. --- For information on how to log in via the API see, [Intro to REST APIs](https://docs.accedian.io/docs/intro-to-rest-apis) or [Querying Session PM data via API](https://docs.accedian.io/v1/docs/en/querying-capture-data) ## Step 2: Create the JWT 1. Create a JWT using the appropriate API endpoint. [https://api.accedian.io/session.html#operation/CreateToken](https://api.accedian.io/session.html#operation/CreateToken) Example request: ``` curl --location --request POST 'https://****/api/v1/auth/tokens' \ --header 'Content-Type: application/vnd.api+json' \ --header 'Cookie: NSREDIRECT=https:///api/v1/auth/tokens; skylight-aaa=' \ --data-raw '{ "data": { "type": "tokens", "attributes": { "iss": "you@yourdomain.com", "sub": "ronald@acme.inc", "aud": "", "exp": } } }' ``` 1. Save the JWT securely; it will not be displayed again. 2. Verify the JWT using [JWT.io](https://jwt.io/) and use their debugger. ![Check JWT.png](https://cdn.document360.io/01d1de5e-a375-4fbc-aa82-666ac04c2113/Images/Documentation/Check%20JWT.png?sv=2026-02-06&spr=https&st=2026-11-23T21%3A12%3A44Z&se=2026-11-23T22%3A12%3A44Z&sr=b&sp=r&sig=mArk9Lmg%2FXabO6PXmUykk%2F4xe%2B8BQxe9bn8OjG%2FkxQc%3D) --- ## Step 3: Use the JWT Embed the JWT in scripts to authenticate sessions before executing tasks: ``` curl --location --request POST 'https:///api/v1/auth/login' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'token=' -v ``` Use the AUTH TOKEN to retrieve PM data, such as calculating average packet loss percentage: ``` curl --location --request POST 'https://demo.labs.analytics.accedian.io/api/v3/metrics/groupBy' \ --header 'Content-Type: application/vnd.api+json' \ --header 'Cookie: skylight-aaa=' \ --data-raw '{ "data": { "type": "groupByMetrics", "attributes": { "aggregation": "avg", "interval": "2021-06-24T02:45:42.945Z/2021-06-25T02:45:42.945Z", "groupingContext": { "strictGroupings": true, "groupings": [ { "groupName": "customer", "groupType": "meta" } ] }, "globalMetricFilterContext": { "objectType": [ "twamp-sl", "twamp-pe", "twamp-sf" ] }, "metrics": [ { "direction": [ "0" ], "objectType": [ "twamp-sl", "twamp-pe", "twamp-sf" ], "metric": "packetsLostPct" } ], "queryContext": { "ignoreCleaning": false, "focusBusyHour": false, "ignoreMaintenance": false, "numResults": 5, "sorted": "desc" } } } }' ``` ### Understanding JWT and AuthToken Integration In our platform, JSON Web Tokens (JWTs) are designed for stateless authentication, providing efficient and secure access to APIs. Here's how they are integrated into our authentication process: #### JWT Usage JWTs are used to authenticate directly with APIs. This means you can access and retrieve data without needing to generate an additional AuthToken, ensuring a streamlined and high-performance interaction. Efficiency and Security: Utilizing JWTs directly minimizes server load and enhances security, as they are inherently stateless and designed for RESTful communication. #### AuthToken Usage While JWTs are preferred for stateless access, AuthTokens may be used in certain scenarios for additional authentication layers. However, the primary goal is to leverage JWTs for direct API access wherever possible. **Important Considerations:** We recognize that excessive use of stateful tokens like AuthTokens can impact performance. Our aim is to minimize their use and rely on JWTs for optimal integration. ### Best Practices Whenever feasible, use JWTs directly to authenticate and access APIs, reducing reliance on AuthTokens. By ensuring that JWTs are securely stored and managed, you maintain the integrity and confidentiality of your data. **© 2026 Cisco and/or its affiliates. All rights reserved.** For more information about trademarks, please visit: [Cisco trademarks](https://www.cisco.com/c/en/us/about/legal/trademarks.html)[](https://www.cisco.com/c/en/us/about/legal/trademarks.html) For more information about legal terms, please visit: [Cisco legal terms](https://www.cisco.com/c/en/us/about/legal/terms-conditions.html)