concatUserFlow method

String concatUserFlow(
  1. String url
)

Concatenates the user flow URL with additional parameters.

Implementation

String concatUserFlow(String url) {
  const idClientParam = '&client_id=';
  const nonceParam = '&nonce=defaultNonce&redirect_uri=';
  const scopeParam = '&scope=';
  const responseTypeParam = '&response_type=';
  const promptParam = '&prompt=login';
  const pageParam = '?p=';
  const codeChallengeMethod =
      '&code_challenge_method=${Constants.defaultCodeChallengeCode}';
  final codeChallenge = "&code_challenge=${pkcePairInstance.codeChallenge}";

  String newParameters = "";
  if (widget.optionalParameters.isNotEmpty) {
    for (OptionalParam param in widget.optionalParameters) {
      newParameters += "&${param.key}=${param.value}";
    }
  }

  return url +
      pageParam +
      widget.userFlowName +
      idClientParam +
      widget.clientId +
      nonceParam +
      widget.redirectUrl +
      scopeParam +
      createScopes(widget.scopes) +
      responseTypeParam +
      widget.responseType +
      promptParam +
      codeChallenge +
      codeChallengeMethod +
      newParameters;
}