-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Basic Authentication.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
title: WidgetMessage: tm-http-request Example - Basic Authentication | ||
tags: $:/tags/Global | ||
|
||
|
||
!! HTTP Basic Authentication | ||
|
||
[[HTTP Basic Authentication|https://en.wikipedia.org/wiki/Basic_access_authentication]] is a simple scheme for HTTP clients pass a username and password to an HTTP server. | ||
|
||
The credentials are passed via the "Authorization" header as the string "Basic " (note the space) followed by the base64-encoded username and password joined with a colon. | ||
|
||
Here is a simple, illustrative example: | ||
|
||
``` | ||
\procedure get-tiddler-list-from-tiddlywiki-server(url,username,password) | ||
\procedure completion-get-json() | ||
\import [subfilter{$:/core/config/GlobalImportFilter}] | ||
<$action-log msg="In completion-get-json"/> | ||
<$action-log/> | ||
\end completion-get-json | ||
<$action-sendmessage | ||
$message="tm-http-request" | ||
url=<<url>> | ||
method="GET" | ||
header-Authorization={{{ [<username>addsuffix[:]addsuffix<password>encodebase64[]addprefix[Basic ]] }}} | ||
oncompletion=<<completion-get-json>> | ||
/> | ||
\end get-tiddler-list-from-tiddlywiki-server | ||
|
||
<$button> | ||
<<get-tiddler-list-from-tiddlywiki-server url:"http://127.0.0.1:8080" username:"Joe" password:"Bloggs">> | ||
Download | ||
</$button> | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters