question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get access token after client authorization

See original GitHub issue

Hi i am building a JavaFX application for Google Drive with basic functionality as (download,upload etc). I am using JavaFX Browser for user Authentication , so i can navigate to the URL and then get the html code .

1)I need to get the Authentication URL 2)I will authenticate with JavaFX Browser , so my question is : -> is the access token shown on the html code?

How to figure the method authorize of DriveSample to return me the Authentication URL :

 /**
   * Authorizes the installed application to access user's protected data.
   */
  private static Credential authorize() throws Exception {
    // load client secrets
    GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY,
        new InputStreamReader(DriveSample.class.getResourceAsStream("/client_secrets.json")));
    if (clientSecrets.getDetails().getClientId().startsWith("Enter")
        || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
      System.out.println(
          "Enter Client ID and Secret from https://code.google.com/apis/console/?api=drive "
              + "into drive-cmdline-sample/src/main/resources/client_secrets.json");
      System.exit(1);
    }
    // set up authorization code flow
    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(httpTransport,
        JSON_FACTORY, clientSecrets, Collections.singleton(DriveScopes.DRIVE_FILE))
            .setDataStoreFactory(dataStoreFactory).build();

    // authorize
    return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");

  }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
myana-maheshcommented, Apr 12, 2021

problem occurred because of headless system of spring boot, headless system’s can’t open browser so use this below code to set headless false in spring boot

public static void main(String[] args) { SpringApplicationBuilder builder = new SpringApplicationBuilder(App.class); builder.headless(false).run(args); }

0reactions
ZChen143commented, Apr 12, 2021

problem occurred because of headless system of spring boot, headless system’s can’t open browser so use this below code to set headless false in spring boot

public static void main(String[] args) { SpringApplicationBuilder builder = new SpringApplicationBuilder(App.class); builder.headless(false).run(args); }

Thank you very much, very helpful!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Obtaining an Access Token by Using a Client Authorization ...
The client credentials workflow allows the client application to obtain an access token by using the basic authorization header.
Read more >
How to get an access token with Auth Code Grant | DocuSign
Open the Apps and Keys page. · Under My Apps / Integration Keys, choose the integration key to use, then select Actions, then...
Read more >
Get Access Tokens - Auth0
After an access token has expired, you can renew your access token. To do so either re-authenticate the user using Auth0 or use...
Read more >
Client access token | Authentication - publiq - Stoplight
The client can request a token on publiq's authorization server with its client id and client secret, and include this token in API...
Read more >
How to get an access token - Tink Docs
Prerequisites · Authorize access to your backend client · Add a user · Grant access to a user · Get the OAuth access...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found