Class OneDriveAuthInfo

java.lang.Object
com.amilesend.onedrive.connection.auth.OneDriveAuthInfo
All Implemented Interfaces:
com.amilesend.client.connection.auth.AuthInfo

public class OneDriveAuthInfo extends Object implements com.amilesend.client.connection.auth.AuthInfo
Represents the authentication information for OAuth (OBO) access to a user's MS OneDrive account. This is returned in response when making calls to acquire the initial token or when refreshing the token.

Note: For business accounts, the auth tokens are only valid with a single resource. If the user is to access a different resource (different service/site), then new access tokens are required. See BusinessAccountAuthManager for more information.

Official documentation

  • Method Details

    • fromJson

      public static OneDriveAuthInfo fromJson(String authInfoJson)
      Deserializes the given authInfoJson string to a new AuthInfo object.
      Parameters:
      authInfoJson - the JSON-formatted auth info
      Returns:
      the new AuthInfo object
      Throws:
      com.google.gson.JsonSyntaxException - if there is an error while deserializing the JSON string
    • getFullToken

      public String getFullToken()
      Gets the full token that is used in request headers to sign API requests. Full token strings are formatted as "[Token Type] [Access token]"
      Returns:
      the full token
    • toJson

      public String toJson()
      Serializes this AuthInfo to a JSON formatted string.
      Returns:
      the JSON formatted AuthInfo
    • copyWithResourceId

      public OneDriveAuthInfo copyWithResourceId(String resourceId)
      Creates a copy of this object while injecting the given resourceId.
      Parameters:
      resourceId - the resource identifier associated with the auth tokens
      Returns:
      the copy
    • builder

    • getTokenType

      public String getTokenType()
      The auth token type. Default is Bearer.
    • getScopes

      public List<String> getScopes()
      The list of scopes, or permissions to access the Graph API.
    • getExpiresIn

      public long getExpiresIn()
      Time in milliseconds when the auth token expires.
    • getExtExpiresIn

      public long getExtExpiresIn()
      Time in milliseconds when the auth token expires.
    • getAccessToken

      @NonNull public @NonNull String getAccessToken()
      The current authorization token used to make API requests.
    • getRefreshToken

      @NonNull public @NonNull String getRefreshToken()
      The current refresh token used to refresh access tokens.
    • getResourceId

      public String getResourceId()
      The associated resource identifier associated with the access tokens (business accounts only).
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object