diff --git a/dev/articles/how-to.html b/dev/articles/how-to.html index c284b08..eec1b69 100644 --- a/dev/articles/how-to.html +++ b/dev/articles/how-to.html @@ -131,7 +131,7 @@
http <- webfakes::local_app_process(webfakes::httpbin_app(), start = TRUE)
http$local_env(list(GITHUB_API = "{url}"))
Sys.getenv("GITHUB_API")
-#> [1] "http://127.0.0.1:39253/"
+#> [1] "http://127.0.0.1:46709/"
http$stop()
Sys.getenv("GITHUB_API")
#> [1] ""
@@ -154,14 +154,14 @@
web <- webfakes::new_app_process(time)
web$url()
-#> [1] "http://127.0.0.1:42247/"
+#> [1] "http://127.0.0.1:45581/"
Use web$url()
to query the URL of the app. For
example:
web$stop()
stops the app and the subprocess as well:
web$stop()
@@ -345,8 +345,8 @@ How do I test a sequence of reques
#> Request failed [401]. Retrying in 1 seconds...
#> Request failed [401]. Retrying in 1 seconds...
#> Request failed [401]. Retrying in 3.7 seconds...
-#> Response [http://127.0.0.1:41853/unstable]
-#> Date: 2025-01-10 13:39
+#> Response [http://127.0.0.1:33021/unstable]
+#> Date: 2025-01-10 15:33
#> Status: 200
#> Content-Type: application/json
#> Size: 17 B
(The http_version = 2
option is currently needed because
of a bug (https://github.com/r-lib/webfakes/issues/108).)
throttle
gives the number of bytes per second, so
downloading 200 random bytes from the fake app will take about 2
seconds.
web <- webfakes::new_app_process(time)
web$url()
-#> [1] "http://127.0.0.1:44981/"
+#> [1] "http://127.0.0.1:44025/"
Use web$url()
to query the URL of the app. For
example:
web$stop()
stops the app and the subprocess as well:
web$stop()
diff --git a/dev/articles/oauth.html b/dev/articles/oauth.html
index 2359ab3..8b7b5f5 100644
--- a/dev/articles/oauth.html
+++ b/dev/articles/oauth.html
@@ -118,9 +118,9 @@ The OAuth2.0 resource an
#> auto_start:
#> TRUE
#> process id:
-#> 8728
+#> 8643
#> http url:
-#> http://127.0.0.1:36245/
+#> http://127.0.0.1:34227/
#> fields and methods:
#> get_app() # get the app object
#> get_port() # query port of the app
@@ -155,9 +155,9 @@ OAuth2.0 app creation & registra
#> auto_start:
#> TRUE
#> process id:
-#> 8741
+#> 8656
#> http url:
-#> http://127.0.0.1:42523/
+#> http://127.0.0.1:33913/
#> fields and methods:
#> get_app() # get the app object
#> get_port() # query port of the app
@@ -181,8 +181,8 @@ OAuth2.0 app creation & registra
)
reg_resp <- httr::GET(url)
reg_resp
-#> Response [http://127.0.0.1:36245/register?name=3P%20app&redirect_uri=http://127.0.0.1:42523/login/redirect]
-#> Date: 2025-01-10 13:39
+#> Response [http://127.0.0.1:34227/register?name=3P%20app&redirect_uri=http://127.0.0.1:33913/login/redirect]
+#> Date: 2025-01-10 15:33
#> Status: 200
#> Content-Type: application/json
#> Size: 184 B
@@ -195,17 +195,17 @@ OAuth2.0 app creation & registra
#>
#> $client_id
#> $client_id[[1]]
-#> [1] "id-00b2323c63b3716183cd5420ba46a3"
+#> [1] "id-6f64d3d57c64cf6345d9fd23f4e7cb"
#>
#>
#> $client_secret
#> $client_secret[[1]]
-#> [1] "secret-dc522c67c8d642605e9b2532deac5f"
+#> [1] "secret-32785e06d75752b55c5edc6e66a73d"
#>
#>
#> $redirect_uri
#> $redirect_uri[[1]]
-#> [1] "http://127.0.0.1:42523/login/redirect"
The resource app replies with the client id and the client secret. Weβll use them to authenticate the third party app. In real life they are included in the config of the third party app by its admin. Our @@ -224,8 +224,8 @@
resp_data <- httr::GET(tpapp2$url("/data"))
resp_data
-#> Response [http://127.0.0.1:40087/data]
-#> Date: 2025-01-10 13:39
+#> Response [http://127.0.0.1:40157/data]
+#> Date: 2025-01-10 15:33
#> Status: 200
#> Content-Type: application/json
#> Size: 24 B
@@ -396,8 +396,8 @@ OAuth2.0 app creation & regist
)
reg_resp3 <- httr::GET(url3)
reg_resp3
-#> Response [http://127.0.0.1:36245/register?name=3P%20app2&redirect_uri=http://localhost:1410/]
-#> Date: 2025-01-10 13:39
+#> Response [http://127.0.0.1:34227/register?name=3P%20app2&redirect_uri=http://localhost:1410/]
+#> Date: 2025-01-10 15:33
#> Status: 200
#> Content-Type: application/json
#> Size: 170 B
@@ -410,12 +410,12 @@ OAuth2.0 app creation & regist
#>
#> $client_id
#> $client_id[[1]]
-#> [1] "id-8db92bf00e8b1272afb5ceee28a286"
+#> [1] "id-5fd7bf82ace939e2a0a4bc17a05c3a"
#>
#>
#> $client_secret
#> $client_secret[[1]]
-#> [1] "secret-36eeb9fd6b05ef5459cb59fef1d12d"
+#> [1] "secret-5ada2a1a4e4acb6b172f17771135e1"
#>
#>
#> $redirect_uri
@@ -446,18 +446,18 @@ OAuth2.0 app creation & regist
token
#> <Token>
#> <oauth_endpoint>
-#> authorize: http://127.0.0.1:36245/authorize
-#> access: http://127.0.0.1:36245/token
+#> authorize: http://127.0.0.1:34227/authorize
+#> access: http://127.0.0.1:34227/token
#> <oauth_app> 3P app2
-#> key: id-8db92bf00e8b1272afb5ceee28a286
+#> key: id-5fd7bf82ace939e2a0a4bc17a05c3a
#> secret: <hidden>
#> <credentials> access_token, expiry, refresh_token
#> ---
Without the token, the query to the resource server fails:
httr::GET(rsapp$url("/data"))
-#> Response [http://127.0.0.1:36245/data]
-#> Date: 2025-01-10 13:39
+#> Response [http://127.0.0.1:34227/data]
+#> Date: 2025-01-10 15:33
#> Status: 401
#> Content-Type: text/plain
#> Size: 20 B