2
私はguideに続いて、Gmailスコープで読み取り専用のアカウントアクセスをユーザーに要求し、authCodeを生成し、バックエンドサーバーに送信するAndroidアプリケーションを作成しています。accessTokenでGmail SDKを使用してGmailにアクセスしますか?
バックエンドサーバーはauthCodeを受信し、acessTokenを生成します。ここではそのためのコードがあります:今、このアクセスを使用して
private static String CLIENT_SECRET_FILE = "/client_secret.json";
private static String REDIRECT_URI = "";
String accessToken = null;
// Exchange auth code for access token
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JacksonFactory.class.newInstance(),
new FileReader(CLIENT_SECRET_FILE));
GoogleTokenResponse tokenResponse = new GoogleAuthorizationCodeTokenRequest(new NetHttpTransport(),
JacksonFactory.class.newInstance(), "https://www.googleapis.com/oauth2/v4/token",
clientSecrets.getDetails().getClientId(), clientSecrets.getDetails().getClientSecret(), authCode,
REDIRECT_URI).execute();
accessToken = tokenResponse.getAccessToken();
は、バックエンドサーバはGmailのSDKを使用してGmailのにアクセスする必要があるトークン。
どうすればよいですか?