Skip to content

Commit 1a4fae3

Browse files
authored
Update README.md
1 parent f38f4a2 commit 1a4fae3

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,47 @@ Our default protections are based on best practices related to avoiding [Cross S
147147
- A default [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) is set using a `<meta>` tag.
148148
- You can provide your own value for this tag using `data.attributes.contentSecurityPolicy` in your `static.json`, or setting the value to `false` to remove the `<meta>` tag.
149149
- The default `<object>` based embed is rendered as a child of a [`<iframe>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) where the [`sandbox`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox), [`allow`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#allow), and additional attributes are used to create as much as an isolated runtime environment as possible.
150+
151+
152+
## Optimizaitons
153+
154+
### Requesting HTTPS Scope on Sign In
155+
156+
Globus Connect Server requires tokens to include [specific scopes](https://docs.globus.org/globus-connect-server/v5.4/https-access-collections/#access_tokens_for_https) when requesting assets over HTTPS. By default, when you use the `globus.embed` type the underlying component will attempt to parse authorization errors from the request and prompt the user to address them (where possible). This default implementation often means the first render of an asset will be a consent error the user needs to address (pictured below).
157+
158+
<img width="1030" alt="Screenshot 2024-11-12 at 4 19 03 PM" src="https://github.com/user-attachments/assets/0aa41b7d-cbd4-4451-ae23-b4179449a2a8">
159+
160+
One way to avoid this initial error is to prompt for the GCS-required scopes at _Sign In_ if the are known – the below example adds a known scope to the configured client.
161+
162+
```jsonc
163+
{
164+
"data": {
165+
"globus": {
166+
"application": {
167+
"client_id": "7442cbd9-2766-42b9-9512-9195b12ed167",
168+
"scopes": [
169+
// The UUID here would reference the Collection where your assets are served from.
170+
"https://auth.globus.org/scopes/a6f165fa-aee2-4fe5-95f3-97429c28bf82/https"
171+
]
172+
}
173+
}
174+
}
175+
}
176+
```
177+
178+
**You very likely want to include this optimization when using `globus.embed`**[^2]. The only time you might not want to use this configuration is if your embedded assets are being loaded from many (dynamic) collections. In these cases, you might not be able to enumerate the scopes as a configuration option, or degrade user experience by asking for unnecessary consent at Sign In.
179+
180+
181+
[^2]: **This** portal does not use this configuration as a way to demonstrate the default behaviors.
182+
183+
184+
185+
186+
187+
188+
189+
190+
191+
192+
193+

0 commit comments

Comments
 (0)