Gitlab API allows developers to access the functionality of Gitlab. With the Gitlab API, developers can integrate Gitlab with other applications, create custom applications, or automate tasks.
Some examples of what you can build using the Gitlab API include:
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
gitlab: {
type: "app",
app: "gitlab",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://gitlab.com/api/v4/user`,
headers: {
Authorization: `Bearer ${this.gitlab.$auth.oauth_access_token}`,
},
})
},
})
Gitlab uses OAuth authentication. When you connect your Gitlab account, Pipedream will open a popup window where you can sign into Gitlab and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Gitlab API.
Pipedream requests the following authorization scopes when you connect your account:
api
read_user
read_repository
write_repository
read_registry
sudo
openid
profile
email
GET
https://gitlab.com/oauth/authorize
?
client_id={{oauth.client_id}}
&
state={{oauth.state}}
&
redirect_uri={{oauth.redirect_uri}}
&
response_type=code
&
scope={{oauth.space_separated_scopes}}
POST
https://gitlab.com/oauth/token
?
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
code={{oauth.code}}
&
grant_type=authorization_code
&
redirect_uri={{oauth.redirect_uri}}
content-type: application/x-www-form-urlencoded
accept: application/json
POST
https://gitlab.com/oauth/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
grant_type=refresh_token
&
refresh_token={{oauth.refresh_token}}