# Github Application Credentials

**URL:** <https://community.jenkins.io/t/github-application-credentials/10706>\
**Category:** Using Jenkins\
**Created:** [November 13, 2023, 7:20pm UTC](https://community.jenkins.io/t/github-application-credentials/10706 "2023-11-13T19:20:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pm-oo](https://avatars.discourse-cdn.com/v4/letter/p/f9ae1b/32.png) [@pm-oo](https://community.jenkins.io/u/pm-oo)\
**Post date:** [November 13, 2023, 7:20pm UTC](https://community.jenkins.io/t/github-application-credentials/10706/1 "2023-11-13T19:20:32Z")

</div>

Hello,

I have a question regarding Github Application Credentials.  
Whenever I search for how it can be used, it seems to be limited to Organization Folders and multibranch pipelines.  
I would like to use it in a declarative pipeline script that is used interactively - so no automatic code scanning etc.

is that possible?

thx

---

<div class="post-metadata">

**Author:** ![poddingue](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/poddingue/32/985_2.png) [@poddingue](https://community.jenkins.io/u/poddingue)\
**Post date:** [November 15, 2023, 4:11pm UTC](https://community.jenkins.io/t/github-application-credentials/10706/2 "2023-11-15T16:11:27Z")

</div>

Hello @pm-oo and welcome to this community. 👋

I think you can use the `withCredentials` step provided by the [Credentials Binding Plugin](https://plugins.jenkins.io/credentials-binding/) to bind your GitHub Application Credentials to variables, and then use these variables in your pipeline script. 🤔

Here is an untested example of how you could maybe do this:

```plaintext
pipeline {
    agent any
    stages {
        stage('Example') {
            steps {
                withCredentials([string(credentialsId: 'my-github-app-credentials', variable: 'GITHUB_TOKEN')]) {
                    // Use the GITHUB_TOKEN variable in your steps
                    sh 'git clone https://x-access-token:${GITHUB_TOKEN}@github.com/your-repo.git'
                }
            }
        }
    }
}

```

In this example, you should replace `my-github-app-credentials` with the ID of your GitHub Application Credentials in Jenkins, and `https://x-access-token:${GITHUB_TOKEN}@github.com/your-repo.git` with the repository you want to clone.

The `withCredentials` step securely provides the credentials to the steps inside its block and masks any output of the credentials in logs.

---

<div class="post-metadata">

**Author:** ![pm-oo](https://avatars.discourse-cdn.com/v4/letter/p/f9ae1b/32.png) [@pm-oo](https://community.jenkins.io/u/pm-oo)\
**Post date:** [November 15, 2023, 8:14pm UTC](https://community.jenkins.io/t/github-application-credentials/10706/3 "2023-11-15T20:14:40Z")

</div>

This probably works. But I think by doing this you are restricted by the GitHub rate limit of an access token and not the higher limits of the Github application

thank you
