/** * Constructor with all parameters allowing custom transport and server URL. * * @param clientId Client ID of the credential from the console. * @param clientSecret Client ID of the credential from the console. * @param refreshToken A refresh token resulting from a OAuth2 consent flow. * @param accessToken Initial or temporary access token. * @param transportFactory HTTP transport factory, creates the transport used to get access * tokens. * @param tokenServerUri URI of the end point that provides tokens. * @deprecated Use {@link #newBuilder()} instead. This constructor will either be deleted or made * private in a later version. */ @Deprecated public UserCredentials(String clientId, String clientSecret, String refreshToken, AccessToken accessToken, HttpTransportFactory transportFactory, URI tokenServerUri) { super(accessToken); this.clientId = Preconditions.checkNotNull(clientId); this.clientSecret = Preconditions.checkNotNull(clientSecret); this.refreshToken = refreshToken; this.transportFactory = firstNonNull(transportFactory, getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.tokenServerUri = (tokenServerUri == null) ? OAuth2Utils.TOKEN_SERVER_URI : tokenServerUri; this.transportFactoryClassName = this.transportFactory.getClass().getName(); Preconditions.checkState(accessToken != null || refreshToken != null, "Either accessToken or refreshToken must not be null"); }
/** * Constructor with all parameters allowing custom transport and server URL. * * @param clientId Client ID of the credential from the console. * @param clientSecret Client ID of the credential from the console. * @param refreshToken A refresh token resulting from a OAuth2 consent flow. * @param accessToken Initial or temporary access token. * @param transportFactory HTTP transport factory, creates the transport used to get access * tokens. * @param tokenServerUri URI of the end point that provides tokens. * @deprecated Use {@link #newBuilder()} instead. This constructor will either be deleted or made * private in a later version. */ @Deprecated public UserCredentials(String clientId, String clientSecret, String refreshToken, AccessToken accessToken, HttpTransportFactory transportFactory, URI tokenServerUri) { super(accessToken); this.clientId = Preconditions.checkNotNull(clientId); this.clientSecret = Preconditions.checkNotNull(clientSecret); this.refreshToken = refreshToken; this.transportFactory = firstNonNull(transportFactory, getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.tokenServerUri = (tokenServerUri == null) ? OAuth2Utils.TOKEN_SERVER_URI : tokenServerUri; this.transportFactoryClassName = this.transportFactory.getClass().getName(); Preconditions.checkState(accessToken != null || refreshToken != null, "Either accessToken or refreshToken must not be null"); }