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: 10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4    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

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


Text.EncodeToBase64 - Text.EncodeToBytes

Feedback: Report problem or ask question.




Links
MBS FileMaker Plugins

Start Chat