signInWithMultipassToken method

Future<ShopifyUser> signInWithMultipassToken(
  1. String multipassToken
)

Tries to sign in a user with the given Multipass token.

Implementation

Future<ShopifyUser> signInWithMultipassToken(
  final String multipassToken,
) async {
  final accessTokenWithExpDate =
      await _createAccessTokenWithMultipass(multipassToken);
  final WatchQueryOptions _getCustomer = WatchQueryOptions(
    document: gql(getCustomerQuery),
    variables: {'customerAccessToken': accessTokenWithExpDate.accessToken},
    fetchPolicy: ShopifyConfig.fetchPolicy,
  );
  final QueryResult result = await _graphQLClient!.query(_getCustomer);
  checkForError(result);
  final shopifyUser = ShopifyUser.fromGraphJson(result.data!['customer']);
  await _setShopifyUser(accessTokenWithExpDate, shopifyUser);

  return shopifyUser;
}