Giter VIP home page Giter VIP logo

Comments (4)

champlin2 avatar champlin2 commented on June 15, 2024 1

from azure-devops-java-sdk.

hkarthik7 avatar hkarthik7 commented on June 15, 2024

Hey @champlin2, You don't necessarily have to use PAT to authenticate the REST API. There are two ways to authenticate, one is using PAT and other is using OAuth2.0. As described in the documentation you need to register your application to get a client id, client secret, callback url. The callback url will have the jwt token.

Using client id, client secret and callaback url create a Connection object. Specify tokenRefreshedHandler to refresh your auth token automatically when it expires.

Please use OAuthApi first to get the authorization endpoint and access token. OAuthApi has static methods,

  • getAuthorizationEndpoint
  • getAccessToken
  • getRefreshToken
  • hasTokenExpired (helper method to check if the token has expired)

OAuthApi injects the timestamp when a new access token is generated and you can use hasTokenExpired to check and get the refresh token.

Once you have the access token, you can then create a connection object with that and call other Apis.

from azure-devops-java-sdk.

hkarthik7 avatar hkarthik7 commented on June 15, 2024

Hiya @champlin2, Please let me know if your issue is solved or you need any help. This issue will be closed after few days.

from azure-devops-java-sdk.

hkarthik7 avatar hkarthik7 commented on June 15, 2024

Cheers, good luck.

from azure-devops-java-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.