AccessToken

public struct AccessToken : Codable, AccessTokenType, Equatable

Represents an access token which is used to access the LINE Platform. Most API calls to the LINE Platform require an access token as evidence of successful authorization. A valid access token is issued after the user grants your app the permissions that your app requests. An access token is bound to permissions (scopes) that define the API endpoints that you can access. Choose the permissions for your channel in the LINE Developers site and set them in the login method used in your app.

An access token will expire after a certain period. Check the expiresAt property, which contains the expiration time calculated with the local time setting. Any API call will attempt to refresh the access token if necessary, when it requires authorization.

By default, the LINE SDK stores an access token in the keychain for your app and obtains authorization when you access the LINE Platform through the framework request methods.

Do not try to create an access token yourself. You can get a valid access token in use by accessing the current property of an AccessTokenStore object.

  • The value of the access token.

    Declaration

    Swift

    public let value: String
  • The creation time of the access token. It is the system time of the device that receives the current access token.

    Declaration

    Swift

    public let createdAt: Date
  • The ID token bound to the access token. The value exists only if the access token is obtained with the .openID permission.

    Declaration

    Swift

    public let IDToken: JWT?
  • The raw string value of the ID token bound to the access token. The value exists only if the access token is obtained with the .openID permission.

    Declaration

    Swift

    public let IDTokenRaw: String?
  • Permissions of the access token.

    Declaration

    Swift

    public let permissions: [LoginPermission]
  • The expiration time of the access token. It is calculated using createdAt and the validity period of the access token. This value might not be the actual expiration time because this value depends on the system time of the device when createdAt is determined.

    Declaration

    Swift

    public var expiresAt: Date { get }