Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 11.4   11.5   12.0   12.1   12.2   12.3   12.4   12.5   13.0   13.1    Statistic    FMM    Blog  

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 does not need a paid license.

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


Text.EncodeToBase64 - Text.EncodeToBytes

💬 Ask a question or report a problem


Start Chat