Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`maybeCacheToken` has a misleading name, it actually is only an optional initial token which will be used until it expires https://github.com/cognitedata/cognite-sdk-scala/blob/2c1e74e67b3eba42ca564f53af08021ba146c642/src/main/scala/com/cognite/sdk/scala/common/OAuth2.scala#L173 https://github.com/cognitedata/cognite-sdk-scala/blob/2c1e74e67b3eba42ca564f53af08021ba146c642/src/main/scala/com/cognite/sdk/scala/common/OAuth2.scala#L200 But after it expires or if it wasn't provided normal path would be used to fetch a new token and persist it via `CachedResource` and invalidate-refresh as needed in `commonGetAuth` https://github.com/cognitedata/cognite-sdk-scala/blob/2c1e74e67b3eba42ca564f53af08021ba146c642/src/main/scala/com/cognite/sdk/scala/common/OAuth2.scala#L133 The intent is to be able to have single seed token for multiple auth instances. Here initial token was supplied out of normal path so exactly the same path as expire-refresh, so removing manually setting initial token would only save some eager requests and extra expiration checks on each refresh (current version of fetching token checks old initial token expiration every single call even after it has expired long time ago) To address separately in scala sdk later: - maybe unwrap `F[Option[initial token]]` back to `Option[initial token]` - rename `maybeCacheToken` to something like `maybeInitialToken` - add support for initial token in sdk to avoid having to hijack refresh path in consumer code each time
- Loading branch information