Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK: Add telemetry library support for the /authenticate API request #4

Closed
rtamalin opened this issue May 31, 2024 · 2 comments
Closed
Labels
enhancement New feature or request SDK

Comments

@rtamalin
Copy link
Collaborator

Leverage the /authenticate API request (#3) to implement authentication support in the telemetry library.

A client will use the /authenticate API request for one of the following reasons:

  • to check that the existing auth token is still valid.
    • e.g. AuthenticationStatus()
    • potentially can also be used to check if telemetry client has been registered?
  • to obtain an updated auth token as the existing one has expired
    • e.g. AuthenticationExtend()
  • to obtain an updated auth token because the existing one is no longer valid
    • e.g. AuthenticationRenew()

The headers of the re-authentication request must include the following items:

  • client id
  • SHA256 of the existing authentication token

The payload of the re-authentication request contains the following items:

  • SHA256 of the client instance id
    • optional, only required if a client is requesting a new token because the existing one has expired or is no longer valid

The telemetry client will be responsible for storing the updated authentication token so that it can be used in future requests.

@rtamalin rtamalin added SDK enhancement New feature or request labels May 31, 2024
@rtamalin rtamalin changed the title SDK: Add a telemetry library support for the /authenticate API request SDK: Add telemetry library support for the /authenticate API request Jun 3, 2024
@rtamalin
Copy link
Collaborator Author

This underlying work for this was completed as part of #38.

The authentication approach was simplified to just requesting an updated client credentials set that includes a freshly generated auth token. The authenticate request requires a payload containing the client's id, and hash digest of it's instance id. These will be used by the server to validate that the client is registered with the server, and that the provided hash digest matches that of the client instance it provided when the client registered.

@rtamalin
Copy link
Collaborator Author

The auth tokens supplied by the server are now JWT's and it should be possible to check locally to determine if they have expired or now.

The server will fail with a HTTP 401 Unauthorized if an auth token is no longer valid, either because it has expired, or because the server had invalidated it, and it will be up to the client to obtain a new auth token using the authenticate request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SDK
Projects
None yet
Development

No branches or pull requests

1 participant