public final class LocalServerReceiver extends Object implements VerificationCodeReceiver
Implementation is thread-safe.
| Modifier and Type | Class and Description |
|---|---|
static class |
LocalServerReceiver.Builder
Builder.
|
| Constructor and Description |
|---|
LocalServerReceiver()
Constructor that starts the server on
LOCALHOST and an unused port. |
| Modifier and Type | Method and Description |
|---|---|
String |
getCallbackPath()
Returns callback path used in redirect_uri.
|
String |
getHost()
Returns the host name to use.
|
int |
getPort()
Returns the port to use or
-1 to select an unused port in getRedirectUri(). |
String |
getRedirectUri() |
void |
stop() |
String |
waitForCode()
Blocks until the server receives a login result, or the server is stopped by
stop(),
to return an authorization code. |
public LocalServerReceiver()
LOCALHOST and an unused port.
Use LocalServerReceiver.Builder if you need to specify any of the optional parameters.
public String getRedirectUri() throws IOException
getRedirectUri in interface VerificationCodeReceiverIOExceptionpublic String waitForCode() throws IOException
stop(),
to return an authorization code.waitForCode in interface VerificationCodeReceivernull if the server is stopped
by stop()IOException - if the server receives an error code (through an HTTP request parameter
error)public void stop()
throws IOException
stop in interface VerificationCodeReceiverIOExceptionpublic String getHost()
public int getPort()
-1 to select an unused port in getRedirectUri().public String getCallbackPath()
Copyright © 2011–2024 Google. All rights reserved.