Repository: cognitedata/cognite-sdk-python

Issue:
OAuthInteractive as client provider does not work on windows
**System information (please complete the following information):**
 - OS: Windows 11
 - Python Version: Python 3.9.12
 - SDK Version: latest

**Describe the bug**
OAuthInteractive as client provider does not work on windows. Seems like the problem is this line, which only makes sense on linux/mac: https://github.com/cognitedata/cognite-sdk-python/blob/75cc08c491a5c588809e41ee279d7fbcf973a19b/cognite/client/credentials.py#L202 

I would suggest changing it to e.g. 
```python
Path(tempfile.gettempdir()) / f"cognitetokencache.{self.__client_id}.bin"
```

**To Reproduce**
Runnable code reproducing the error.
```python
from cognite.client import CogniteClient, ClientConfig
from cognite.client.credentials import OAuthInteractive
import os 

authority_url = os.getenv("COGNITE_AUTHORITY_URL")
client_id = os.getenv("COGNITE_CLIENT_ID")
project = os.getenv("COGNITE_PROJECT")
oauth_provider = OAuthInteractive(
    authority_url=authority_url,
    client_id=client_id,
    scopes=["https://api.cognitedata.com/.default"],
conf = ClientConfig(client_name="my_super_client", base_url="https://api.cognitedata.com", project=project, credentials=oauth_provider)
client = CogniteClient(config=conf)

client.assets.list()
```
**Expected behavior**
It should open an interactive login prompt.

**Screenshots**
![image](https://user-images.githubusercontent.com/2263072/212712832-b6dc2ea1-a19a-4857-88e8-3bca488ae363.png)




Discussion:

Resolving patch:
diff --git a/cognite/client/_version.py b/cognite/client/_version.py
--- a/cognite/client/_version.py
+++ b/cognite/client/_version.py
@@ -1,4 +1,4 @@
 from __future__ import annotations
 
-__version__ = "5.3.2"
+__version__ = "5.3.3"
 __api_subversion__ = "V20220125"
diff --git a/cognite/client/credentials.py b/cognite/client/credentials.py
--- a/cognite/client/credentials.py
+++ b/cognite/client/credentials.py
@@ -1,6 +1,7 @@
 from __future__ import annotations
 
 import atexit
+import tempfile
 import threading
 from abc import abstractmethod
 from datetime import datetime
@@ -107,7 +108,7 @@ def _create_serializable_token_cache(cache_path: Path) -> SerializableTokenCache
 
         def __at_exit() -> None:
             if token_cache.has_state_changed:
-                with open(cache_path, "w") as fh:
+                with open(cache_path, "w+") as fh:
                     fh.write(token_cache.serialize())
 
         atexit.register(__at_exit)
@@ -121,6 +122,8 @@ class OAuthDeviceCode(_OAuthCredentialProviderWithTokenRefresh, _WithMsalSeriali
         authority_url (str): OAuth authority url
         client_id (str): Your application's client id.
         scopes (List[str]): A list of scopes.
+        token_cache_path (Path): Location to store token cache, defaults to
+                                 os temp directory/cognitetokencache.{client_id}.bin.
 
     Examples:
 
@@ -132,14 +135,20 @@ class OAuthDeviceCode(_OAuthCredentialProviderWithTokenRefresh, _WithMsalSeriali
             ... )
     """
 
-    def __init__(self, authority_url: str, client_id: str, scopes: List[str]) -> None:
+    def __init__(
+        self,
+        authority_url: str,
+        client_id: str,
+        scopes: List[str],
+        token_cache_path: Path = None,
+    ) -> None:
         super().__init__()
         self.__authority_url = authority_url
         self.__client_id = client_id
         self.__scopes = scopes
 
         # In addition to caching in memory, we also cache the token on disk so it can be reused across processes.
-        token_cache_path = Path(f"/tmp/cognitetokencache.{self.__client_id}.bin")
+        token_cache_path = token_cache_path or Path(tempfile.gettempdir()) / f"cognitetokencache.{self.__client_id}.bin"
         serializable_token_cache = self._create_serializable_token_cache(token_cache_path)
         self.__app = PublicClientApplication(
             client_id=self.__client_id, authority=self.__authority_url, token_cache=serializable_token_cache
@@ -182,6 +191,8 @@ class OAuthInteractive(_OAuthCredentialProviderWithTokenRefresh, _WithMsalSerial
         client_id (str): Your application's client id.
         scopes (List[str]): A list of scopes.
         redirect_port (List[str]): Redirect port defaults to 53000.
+        token_cache_path (Path): Location to store token cache, defaults to
+                                 os temp directory/cognitetokencache.{client_id}.bin.
 
     Examples:
 
@@ -193,7 +204,14 @@ class OAuthInteractive(_OAuthCredentialProviderWithTokenRefresh, _WithMsalSerial
             ... )
     """
 
-    def __init__(self, authority_url: str, client_id: str, scopes: List[str], redirect_port: int = 53000) -> None:
+    def __init__(
+        self,
+        authority_url: str,
+        client_id: str,
+        scopes: List[str],
+        redirect_port: int = 53000,
+        token_cache_path: Path = None,
+    ) -> None:
         super().__init__()
         self.__authority_url = authority_url
         self.__client_id = client_id
@@ -201,7 +219,7 @@ def __init__(self, authority_url: str, client_id: str, scopes: List[str], redire
         self.__redirect_port = redirect_port
 
         # In addition to caching in memory, we also cache the token on disk so it can be reused across processes.
-        token_cache_path = Path(f"/tmp/cognitetokencache.{self.__client_id}.bin")
+        token_cache_path = token_cache_path or Path(tempfile.gettempdir()) / f"cognitetokencache.{self.__client_id}.bin"
         serializable_token_cache = self._create_serializable_token_cache(token_cache_path)
         self.__app = PublicClientApplication(
             client_id=self.__client_id, authority=self.__authority_url, token_cache=serializable_token_cache


Test patch: