<PackageReference Include="Microsoft.Identity.Client" Version="4.85.1" />

Microsoft.Identity.Client.Utils.Base64UrlHelpers

static class Base64UrlHelpers
public static string Decode(string arg)

Decodes the string from Base64UrlEncoded to UTF8.

public static byte[] DecodeBytes(string str)

Converts the specified string, which encodes binary data as base-64-url digits, to an equivalent 8-bit unsigned integer array.

public static string Encode(string arg)

The following functions perform base64url encoding which differs from regular base64 encoding as follows * padding is skipped so the pad character '=' doesn't have to be percent encoded * the 62nd and 63rd regular base64 encoding characters ('+' and '/') are replace with ('-' and '_') The changes make the encoding alphabet file and URL safe.

public static string Encode(byte[] inArray)

Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64-url digits. Parameters specify the subset as an offset in the input array, and the number of elements in the array to convert.