How can i obtaining GoogleCredentials using OAuth 2.0 Client ID in Java?

65 Views Asked by At

I'm not good at English, so My sentence is probally weird, I'm sorry

I'm making web project in first time, then i just want to use google photo api

so i read Get started with Java client library

// Set up the Photos Library Client that interacts with the API
PhotosLibrarySettings settings =
     PhotosLibrarySettings.newBuilder()
    .setCredentialsProvider(
        FixedCredentialsProvider.create(/* Add credentials here. */)) 
    .build();

try (PhotosLibraryClient photosLibraryClient =
    PhotosLibraryClient.initialize(settings)) {

    // Create a new Album  with at title
    Album createdAlbum = photosLibraryClient.createAlbum("My Album");

    // Get some properties from the album, such as its ID and product URL
    String id = album.getId();
    String url = album.getProductUrl();

} catch (ApiException e) {
    // Error during album creation
}

I have OAuth client Id, secret with Json file but i can't understand how can i get credentials

I spend this in 5 days... how can i get credentials using OAuth 2.0 Client ID in Java? Or can you teach me Associated Keywords?

I read api documnet,github and Associated blogs and ask for chatgpt over and over but i can't find a way at all

github about google-auth-library-java github about java-photoslibrary google photo api document

0

There are 0 best solutions below