Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Text.EncodeToBase64URL

Encode a base64 URL string.

Component Version macOS Windows Linux Server iOS SDK
Text 7.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.EncodeToBase64URL"; text { ; encoding } )   More

Parameters

Parameter Description Example Flags
text The text to process. "Hello World"
encoding The text encoding for text parameter.
Default is native.
"UTF-8" Optional

Result

Returns encoded text.

Description

Encode a base64 URL string.
Please check what text encoding you want to use. Especially what the software processing the base64 string expects.
Similar to normal Base64, but + replaced by - and / by _ and the = on the end are omitted.

Examples

Encode Base64 as UTF-8:

MBS( "Text.EncodeToBase64URL"; "Hello World"; "utf8" )

Example result: "SGVsbG8gV29ybGQ"

Encode with/without URL option:

MBS( "Text.EncodeToBase64URL"; "Hello World? öäü"; "UTF-8" ) & ¶ &
MBS( "Text.EncodeToBase64"; "Hello World? öäü"; "UTF-8" )

Calculate a JSON Web Token (JWT) in FileMaker:

Let ( [
secret = "secretkey";
header = JWT RS256::Header;
payload = JWT RS256::Payload;
encodedString = MBS( "Text.EncodeToBase64URL"; header; "UTF-8" ) & "." & MBS( "Text.EncodeToBase64URL"; payload; "UTF-8" );

// calculate hash
hash = MBS( "RSA.Sign"; "SHA256";
"Text"; encodedString; "UTF-8";
"Text"; JWT RS256::Key; "UTF-8";
"text"; JWT RS256::Password; "UTF-8";
"base64url"; "");

// and built final result:
result = encodedString & "." & hash
]; result )

See also

Example Databases

Blog Entries

This function is free to use.

Created 21st October 2017, last changed 27th May 2020


Text.EncodeToBase64 - Text.EncodeToBytes