cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP 403 on git-credentials API

sfalquier
New Contributor II

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>

3 REPLIES 3

Ajay-Pandey
Esteemed Contributor III

Hi @Sébastien FALQUIER​ please refer below link this might help you-

Link

Link2

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.

Vivian_Wilfred
Honored Contributor
Honored Contributor

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.