Google-RestApi

 view release on metacpan or  search on metacpan

bin/google_restapi_oauth_token_creator  view on Meta::CPAN


=head1 SYNOPSIS

Script to create an OAuth2 token that can be stored and used later to authorize
REST API access to your Google account.

Based on code from https://gist.github.com/hexaddikt/6738162

=head1 INITIAL GOOGLE CLOUD SETUP

Before running this script you need a Google Cloud project with OAuth credentials
and the relevant APIs enabled. This is a one-time setup per project.

=head2 1. Create a Google Cloud Project

=over

=item * Go to L<https://console.cloud.google.com> and sign in.

=item * Click the project dropdown at the top and select B<New Project>.

bin/google_restapi_oauth_token_creator  view on Meta::CPAN

=item * Click B<+ Create Credentials> and select B<OAuth client ID>.

=item * Choose B<Desktop app>, give it a name, and click B<Create>.

=item * Copy the B<Client ID> and B<Client Secret> shown in the confirmation dialog.

=back

=head2 5. Create a Config File

Create a YAML file with your credentials. If the config file is shared with
other applications, nest the Google::RestApi configuration under an optional
C<google_restapi> top-level key; otherwise place it at the root:

    ---
    # shared config — google_restapi section is used by this package:
    google_restapi:
        auth:
            class: OAuth2Client
            client_id: <client-id-from-google>
            client_secret: <client-secret-from-google>

lib/Google/RestApi/Auth/ServiceAccount.pm  view on Meta::CPAN

      config_dir   => ReadableDir, { optional => 1 },
      config_file  => ReadableFile, { optional => 1 },
      account_file => ReadableFile,
      scope        => ArrayRef[Str],
    ],
  );
  $self = $check->(%$self);
  $self = bless $self, $class;

  my $auth = WWW::Google::Cloud::Auth::ServiceAccount->new(
    credentials_path => $self->{account_file},
    # undocumented feature of WWW::Google::Cloud::Auth::ServiceAccount
    scope            => join(' ', @{ $self->{scope} }),
  );
  $self->{auth} = $auth;

  return $self;
}

sub headers {
  my $self = shift;



( run in 0.637 second using v1.01-cache-2.11-cpan-39bf76dae61 )