cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.