Class TokenResponse

  • All Implemented Interfaces:
    java.lang.Cloneable, java.util.Map<java.lang.String,​java.lang.Object>
    Direct Known Subclasses:
    IdTokenResponse

    public class TokenResponse
    extends com.google.api.client.json.GenericJson
    OAuth 2.0 JSON model for a successful access token response as specified in Successful Response.

    Implementation is not thread-safe.

    Since:
    1.7
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.google.api.client.util.GenericData

        com.google.api.client.util.GenericData.Flags
      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String accessToken
      Access token issued by the authorization server.
      private java.lang.Long expiresInSeconds
      Lifetime in seconds of the access token (for example 3600 for an hour) or null for none.
      private java.lang.String refreshToken
      Refresh token which can be used to obtain new access tokens using RefreshTokenRequest or null for none.
      private java.lang.String scope
      Scope of the access token as specified in Access Token Scope or null for none.
      private java.lang.String tokenType
      Token type (as specified in Access Token Types).
    • Constructor Summary

      Constructors 
      Constructor Description
      TokenResponse()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TokenResponse clone()  
      java.lang.String getAccessToken()
      Returns the access token issued by the authorization server.
      java.lang.Long getExpiresInSeconds()
      Returns the lifetime in seconds of the access token (for example 3600 for an hour) or null for none.
      java.lang.String getRefreshToken()
      Returns the refresh token which can be used to obtain new access tokens using the same authorization grant or null for none.
      java.lang.String getScope()
      Returns the scope of the access token or null for none.
      java.lang.String getTokenType()
      Returns the token type (as specified in Access Token Types).
      TokenResponse set​(java.lang.String fieldName, java.lang.Object value)  
      TokenResponse setAccessToken​(java.lang.String accessToken)
      Sets the access token issued by the authorization server.
      TokenResponse setExpiresInSeconds​(java.lang.Long expiresInSeconds)
      Sets the lifetime in seconds of the access token (for example 3600 for an hour) or null for none.
      TokenResponse setRefreshToken​(java.lang.String refreshToken)
      Sets the refresh token which can be used to obtain new access tokens using the same authorization grant or null for none.
      TokenResponse setScope​(java.lang.String scope)
      Sets the scope of the access token or null for none.
      TokenResponse setTokenType​(java.lang.String tokenType)
      Sets the token type (as specified in Access Token Types).
      • Methods inherited from class com.google.api.client.json.GenericJson

        getFactory, setFactory, toPrettyString, toString
      • Methods inherited from class com.google.api.client.util.GenericData

        entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, setUnknownKeys
      • Methods inherited from class java.util.AbstractMap

        clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, size, values
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Field Detail

      • accessToken

        private java.lang.String accessToken
        Access token issued by the authorization server.
      • tokenType

        private java.lang.String tokenType
        Token type (as specified in Access Token Types).
      • expiresInSeconds

        private java.lang.Long expiresInSeconds
        Lifetime in seconds of the access token (for example 3600 for an hour) or null for none.
      • refreshToken

        private java.lang.String refreshToken
        Refresh token which can be used to obtain new access tokens using RefreshTokenRequest or null for none.
      • scope

        private java.lang.String scope
        Scope of the access token as specified in Access Token Scope or null for none.
    • Constructor Detail

      • TokenResponse

        public TokenResponse()
    • Method Detail

      • getAccessToken

        public final java.lang.String getAccessToken()
        Returns the access token issued by the authorization server.
      • setAccessToken

        public TokenResponse setAccessToken​(java.lang.String accessToken)
        Sets the access token issued by the authorization server.

        Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      • getTokenType

        public final java.lang.String getTokenType()
        Returns the token type (as specified in Access Token Types).
      • setTokenType

        public TokenResponse setTokenType​(java.lang.String tokenType)
        Sets the token type (as specified in Access Token Types).

        Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      • getExpiresInSeconds

        public final java.lang.Long getExpiresInSeconds()
        Returns the lifetime in seconds of the access token (for example 3600 for an hour) or null for none.
      • setExpiresInSeconds

        public TokenResponse setExpiresInSeconds​(java.lang.Long expiresInSeconds)
        Sets the lifetime in seconds of the access token (for example 3600 for an hour) or null for none.

        Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      • getRefreshToken

        public final java.lang.String getRefreshToken()
        Returns the refresh token which can be used to obtain new access tokens using the same authorization grant or null for none.
      • setRefreshToken

        public TokenResponse setRefreshToken​(java.lang.String refreshToken)
        Sets the refresh token which can be used to obtain new access tokens using the same authorization grant or null for none.

        Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      • getScope

        public final java.lang.String getScope()
        Returns the scope of the access token or null for none.
      • setScope

        public TokenResponse setScope​(java.lang.String scope)
        Sets the scope of the access token or null for none.

        Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

      • set

        public TokenResponse set​(java.lang.String fieldName,
                                 java.lang.Object value)
        Overrides:
        set in class com.google.api.client.json.GenericJson
      • clone

        public TokenResponse clone()
        Overrides:
        clone in class com.google.api.client.json.GenericJson