We will pass them to the SDK init such as the below:
// token is *oauth2.Token
sdk.WithOAuthAccessTokenSource(oauth2.StaticTokenSource(token))
There are two things we should improve.
The result of the library's call oidcCLI.CodeFlow[*oidc.IDTokenClaims] is a decorated struct type and we're pulling the Token field of type *oauth2.Token off it. However, this is missing the Expiry field that the SDK will utilize in the Valid() call downstream.
The Login result does not provide the id or refresh tokens for storage in the auth profile/keyring. We should store those for CLI-initiated refreshes later on.
We recently added a PKCE Auth Code flow login resulting in OIDC tokens.
https://github.com/opentdf/otdfctl/blob/main/pkg/handlers/auth.go#L136-L137
We will pass them to the SDK init such as the below:
There are two things we should improve.
oidcCLI.CodeFlow[*oidc.IDTokenClaims]
is a decorated struct type and we're pulling theToken
field of type*oauth2.Token
off it. However, this is missing theExpiry
field that the SDK will utilize in theValid()
call downstream.Login
result does not provide the id or refresh tokens for storage in the auth profile/keyring. We should store those for CLI-initiated refreshes later on.