cancel
Showing results for 
Search instead for 
Did you mean: 

Expression for decodeBase64Url

Idea: create an expression for decodeBase64Url

 

Base64Url is a variation of Base64 that is used to make Base64 encoded strings URL safe.  Base64Url is also used to encode JWT authentication tokens (like the ones returned from Power Virtual Agents).  Base64Url differs in a few ways from Base64: it replaces special URL characters (+ --> -, / --> _), it removes the need for string padding (=), it disallows line breaks.  C# implements a method for this (WebEncoders.Base64UrlDecode).

 

For others that have experienced this related issue: the current base64decode expression is very strict on the use of "=" padding characters at the end of the input string.  Having missing padding (as presented by a Base64Url encoded string) leads to this error:

 

Unable to process template language expressions in action 'Compose_3' inputs at line '1' and column '2680': 'The template language function 'decodeBase64' was invoked with a parameter that is not valid. The value cannot be decoded from base64 representation.'.

 

Ensuring that the string has a length divisible by 4 by adding trailing "=" characters resolves this issue when it's due to missing padding.

 

Status: New