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

Ajay Kumar Pandey

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
Databricks Employee
Databricks Employee

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.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group