public class Auth
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHANNEL_AUDIT_SCOPE
Scope that allows retrieving the 'auditDetails' part in a 'channel' resource
|
static HttpTransport |
HTTP_TRANSPORT
Global instance of the HTTP transport.
|
static JsonFactory |
JSON_FACTORY
Global instance of the JSON factory.
|
static java.lang.String |
MANAGE_SCOPE
Scope that allows managing a YouTube account
|
static java.lang.String |
UPLOAD_SCOPE
Scope that allows uploading and managing YouTube videos of a YouTube account
|
static java.lang.String |
VIEW_SCOPE
Scope that allows only viewing a YouTube account
|
Constructor and Description |
---|
Auth(java.util.List<java.lang.String> scopes,
java.lang.String credentialDatastore,
int localPort)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Credential |
authorize()
Authorizes the installed application to access user's protected data.
|
void |
logout()
Log out from the current Google account
|
java.lang.String |
revoke()
Revoke all authorized tokens and remove the credential file, so that the next authorization is going to ask the user for permissions again.
|
void |
setScopes(java.util.List<java.lang.String> scopes)
Set a new list of scopes
|
public static final java.lang.String MANAGE_SCOPE
public static final java.lang.String VIEW_SCOPE
public static final java.lang.String UPLOAD_SCOPE
public static final java.lang.String CHANNEL_AUDIT_SCOPE
public static final HttpTransport HTTP_TRANSPORT
public static final JsonFactory JSON_FACTORY
public Auth(java.util.List<java.lang.String> scopes, java.lang.String credentialDatastore, int localPort)
scopes
- List of scopes needed to use/modify YouTube datacredentialDatastore
- File name for the credential datastorepublic void setScopes(java.util.List<java.lang.String> scopes)
scopes
- List of scopes needed to use/modify YouTube datapublic void logout() throws java.io.IOException, java.net.URISyntaxException
java.io.IOException
java.net.URISyntaxException
public java.lang.String revoke() throws java.io.IOException, java.lang.ArrayIndexOutOfBoundsException
java.io.IOException
java.lang.ArrayIndexOutOfBoundsException
public Credential authorize() throws java.io.IOException
java.io.IOException