Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get token details? #1034

Closed
pramsden opened this issue Sep 28, 2023 · 2 comments · Fixed by #1035
Closed

How to get token details? #1034

pramsden opened this issue Sep 28, 2023 · 2 comments · Fixed by #1035

Comments

@pramsden
Copy link

I am using a Group Access Token to allow read-only access to a GitLab repository in a desktop app.

I would like to fetch the expiry date of the token at runtime. It is possible to do this using gitlab4j?

The GitLab API seems to support it:

GET groups/:id/access_tokens/:token_id
@jmini
Copy link
Collaborator

jmini commented Sep 28, 2023

Gitlab documentation: https://docs.gitlab.com/ee/api/group_access_tokens.html

Related PR: #963 to create User access token.

jmini added a commit to jmini/gitlab4j-api that referenced this issue Sep 28, 2023
jmini added a commit to jmini/gitlab4j-api that referenced this issue Sep 29, 2023
@jmini
Copy link
Collaborator

jmini commented Sep 29, 2023

Have a look at the PR #1035 (feel free to review it and give feedback)


You can use jitpack to test in advance:

I created a tag in my fork in my fork: 5.3.0-pr_1035, to test the PR and have a fixed version created by jitpack.

Usage with gradle:

repositories {
    mavenCentral()
    maven {
        url "https://jitpack.io"
        content {
            includeGroup "com.github.jmini"
        }
    }
}

dependencies {
    // ...
    implementation 'com.github.jmini:gitlab4j-api:3da62c6dcd'
    // ...
}

Usage with maven:

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>com.github.unblu</groupId>
    <artifactId>gitlab4j-api</artifactId>
    <version>3da62c6dcd</version>
  </dependency>
  <!-- ... -->
</dependencies>

Usage with jbang:

The example script uses Jbang where loading the dependency is really easy. You just need to declare this dependency:

//DEPS https://github.com/jmini/gitlab4j-api/tree/3da62c6dcd

Instead of:

//DEPS org.gitlab4j:gitlab4j-api:5.3.0

And then Jbang does the work of adding the additional repository for you.

jmini added a commit that referenced this issue Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants