HTTP 403 on git-credentials API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 02:29 AM
Hi,
I am trying to set git credentials for my service principal. I follow the process described here but I get a 403 error when making the POST request to ${DATABRICKS_HOST}/api/2.0/git-credentials with service principal token.
By the way, I also cannot access this API with my PAT (see below) and get the same 403 Invalid access token error.
Is there any restriction on git-credentials API ? How to make it work ?
Regards,
Sébastien
curl -X GET ${DATABRICKS_HOST}/api/2.0/git-credentials --header 'Authorization: Bearer ${DATABRICKS_TOKEN}'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 403 Invalid access token.</title>
</head>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /api/2.0/git-credentials. Reason:
<pre> Invalid access token.</pre></p>
</body>
</html>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 03:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 05:00 AM
Thanks for your help but my issue deals with git-credentials API authentication for a service principal. I do not have issue to connect and use git repositories from workspace webapp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 07:48 AM
Hi @Sébastien FALQUIER it works for me, there are no restrictions. Maybe the PAT token you generated for the service principle got expired. Can you generate a new token and try to run GET/git-credentials API?
How are you creating PAT for service principle? If you use api/2.0/token-management/on-behalf-of/tokens make sure to set lifetime_seconds to a longer duration.
Mark this comment as "best answer" if this resolves your query.