<@U01QEJ9PP53> <@U02H1A95XDW> I’ve created a new a...
# ask-community
f
@Kevin Kho @Anna Geller I’ve created a new api key for one of our service accounts using the
Create API Key
option in prefect cloud’s
Service Account
page. When I use that for flow registration I get this warning:
Copy code
/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/prefect/client/client.py:175: UserWarning: Client was created with an API token configured for authentication. API tokens are deprecated, please use API keys instead.
I set the auth token/key in a python file like this:
Copy code
client = prefect.Client(
        api_token='secret value'
    )
client.save_api_token()
The docs only seem to show how to set
auth_api_key
when using the prefect cli or a graphql query. Does this mean using the api you’re still using the deprecated token? (I’ve peeked into prefect’s implementation for the
Client
class and everything still says
api_token
, but that might be a red herring!)
k
Use
api_key
instead of
api_token
in the Client. Key is now preferred going forward. A bit more info in the docstring here
👌 1
For 0.15.0 and above
key
is preferred over token, but token is still backward compatible, which is why you may see it in the source code.
👌 1
f
@Kevin Kho thank you, makes sense!! (I think we’re still using older Prefect versions in some of our projects which might be why I couldn’t find
api_key
!)