ManagedAuthToken.fromCode constructor

ManagedAuthToken.fromCode(
  1. AuthCode code
)

Instance from an AuthCode.

Implementation

ManagedAuthToken.fromCode(AuthCode code) : super() {
  final tokenResourceOwner = entity
      .relationships!["resourceOwner"]!.destinationEntity!
      .instanceOf()!;
  tokenResourceOwner["id"] = code.resourceOwnerIdentifier;

  this
    ..code = code.code
    ..resourceOwner = tokenResourceOwner as ResourceOwnerTableDefinition
    ..issueDate = code.issueDate
    ..expirationDate = code.expirationDate
    ..scope = code.requestedScopes?.map((s) => s.toString()).join(" ")
    ..client = (ManagedAuthClient()..id = code.clientID);
}