mirror of
https://github.com/supabase/supabase.git
synced 2026-09-22 13:37:53 +08:00
24be387cdb
## What kind of change does this PR introduce? Docs update. Aligns documentation and style guides with the **Sign in / Sign out / Sign up** platform standard. Closes DOCS-1328. Related to [#49874](https://github.com/supabase/supabase/pull/49874). ## What is the current behavior? Docs style guides prefer _login_ / _log in_. Guide prose uses mixed login and sign in wording. ## What is the new behavior? - [WORD_LIST.md](apps/docs/WORD_LIST.md) and [copywriting.mdx](apps/design-system/content/docs/copywriting.mdx) document the sign in standard - Design-system auth examples updated - Guide prose and API reference spec descriptions updated ### Terminology **Standard:** Use _sign in_, _sign out_, and _sign up_ as verbs. Use _sign-in_, _sign-out_, and _sign-up_ as nouns and adjectives. Match Studio UI labels (**Sign in**, **Sign out**, **Sign up**). **Preserved intentionally:** | Category | Keep as-is | Example | | -------- | ---------- | ------- | | Feature name | social login | `/social-login`, `features.mdx` heading, OAuth provider section | | URL slugs | `login` in paths | `/phone-login`, `/login-flows`, `choosing-login-flow` | | CLI | `supabase login` / `supabase logout` | Reference ids `supabase-login` / `supabase-logout`; executable commands unchanged | | SDK methods | `logout()` | Kotlin/Swift method names in API reference titles and examples | | Third-party UI | Provider product labels | Facebook Login, Kakao Login, portal **Login** buttons | | Postgres | Database terminology | login privileges, login credentials, login via role | | Audit/logging | Log prose | "Generates the following **log** in the Postgres Logs" | | Code and routes | Paths and filenames | `app/login/`, `Login.tsx`, `demos/android-login` | | External URLs | Third-party login pages | `dash.cloudflare.com/login`, `console.neon.tech/login`, `vercel.com/login` | | API identifiers | Event and field names | Audit actions `login`/`logout`, `should_logout_user` | ## To test - Run `pnpm lint:mdx` in `apps/docs` - Spot-check `features.mdx`, `social-login.mdx`, and a provider guide (e.g. Facebook, Kakao) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Standardized authentication terminology across guides, reference material, CLI documentation, and copywriting guidance using “sign in,” “sign out,” and “sign up.” * Updated authentication instructions, headings, link text, examples, and SSO guidance for clearer, more consistent wording. * Corrected related grammar, spelling, hyphenation, and documentation links while preserving established product names and implementation commands. * **Style** * Refined code examples with consistent import ordering and spacing. * **Examples** * Updated authentication button and menu labels to “Sign in” and “Sign out.” <!-- end of auto-generated comment: release notes by coderabbit.ai -->
147 lines
4.0 KiB
Plaintext
147 lines
4.0 KiB
Plaintext
---
|
|
id: 'storage-image-downloads'
|
|
title: 'Serving assets from Storage'
|
|
description: 'Serving assets from Storage'
|
|
subtitle: 'Serving assets from Storage'
|
|
sidebar_label: 'Serving assets'
|
|
tocVideo: 'dLqSmxX3r7I'
|
|
---
|
|
|
|
## Public buckets
|
|
|
|
As mentioned in the [Buckets Fundamentals](/docs/guides/storage/buckets/fundamentals) all files uploaded in a public bucket are publicly accessible and benefit a high CDN cache HIT ratio.
|
|
|
|
You can access them by using this conventional URL:
|
|
|
|
```
|
|
https://[project_id].supabase.co/storage/v1/object/public/[bucket]/[asset-name]
|
|
```
|
|
|
|
You can also use the Supabase SDK `getPublicUrl` to generate this URL for you
|
|
|
|
```js
|
|
import { createClient } from '@supabase/supabase-js'
|
|
|
|
const supabase = createClient('your_project_url', 'your_supabase_api_key')
|
|
|
|
// ---cut---
|
|
const { data } = supabase.storage.from('bucket').getPublicUrl('filePath.jpg')
|
|
|
|
console.log(data.publicUrl)
|
|
```
|
|
|
|
### Downloading
|
|
|
|
If you want the browser to start an automatic download of the asset instead of trying serving it, you can add the `?download` query string parameter.
|
|
|
|
By default it will use the asset name to save the file on disk. You can optionally pass a custom name to the `download` parameter as following: `?download=customname.jpg`
|
|
|
|
#### Programmatic downloads with query parameters
|
|
|
|
When using the SDK's `download()` method, you can pass additional query parameters to customize the download behavior:
|
|
|
|
<Tabs
|
|
scrollable
|
|
size="small"
|
|
type="underlined"
|
|
defaultActiveId="js"
|
|
queryGroup="language"
|
|
>
|
|
<TabPanel id="js" label="JavaScript">
|
|
|
|
```js
|
|
import { createClient } from '@supabase/supabase-js'
|
|
|
|
const supabase = createClient('your_project_url', 'your_supabase_api_key')
|
|
|
|
// ---cut---
|
|
// Download with custom filename
|
|
const { data, error } = await supabase.storage.from('avatars').download('avatar1.png', {
|
|
download: 'my-custom-name.png',
|
|
})
|
|
```
|
|
|
|
</TabPanel>
|
|
<$Show if="sdk:dart">
|
|
<TabPanel id="dart" label="Dart">
|
|
|
|
```dart
|
|
// Download with additional query parameters
|
|
final response = await supabase.storage
|
|
.from('avatars')
|
|
.download(
|
|
'avatar1.png',
|
|
queryParams: {
|
|
'download': 'my-custom-name.png',
|
|
},
|
|
);
|
|
```
|
|
|
|
[Reference.](/docs/reference/dart/storage-from-download)
|
|
|
|
</TabPanel>
|
|
</$Show>
|
|
<$Show if="sdk:swift">
|
|
<TabPanel id="swift" label="Swift">
|
|
|
|
```swift
|
|
// Download with additional query parameters
|
|
let response = try await supabase.storage
|
|
.from("avatars")
|
|
.download(
|
|
path: "avatar1.png",
|
|
queryItems: [
|
|
URLQueryItem(name: "download", value: "my-custom-name.png")
|
|
]
|
|
)
|
|
```
|
|
|
|
[Reference.](/docs/reference/swift/storage-from-download)
|
|
|
|
</TabPanel>
|
|
</$Show>
|
|
</Tabs>
|
|
|
|
## Private buckets
|
|
|
|
Assets stored in a non-public bucket are considered private and are not accessible via a public URL like the public buckets.
|
|
|
|
You can access them only by:
|
|
|
|
- Signing a time limited URL on the Server, for example with Edge Functions.
|
|
- with a GET request the URL `https://[project_id].supabase.co/storage/v1/object/authenticated/[bucket]/[asset-name]` and the user Authorization header
|
|
|
|
### Signing URLs
|
|
|
|
<Admonition type="note">
|
|
|
|
Storage signed URLs are signed with a dedicated internal key that is separate from your project's Auth JWT signing key. Each project has its own signing key.
|
|
|
|
Because signed URLs use this separate key, they are not affected by:
|
|
|
|
- Rotating or revoking Auth JWT legacy secret or signing key
|
|
- Disabling legacy keys in the dashboard
|
|
- Switching from HS256 to asymmetric (ES256) signing key
|
|
|
|
Signed URLs remain valid until their expiry time regardless of any Auth key changes.
|
|
|
|
If you need to revoke signed URLs, [contact Supabase support](/dashboard/support/new?projectRef=).
|
|
|
|
</Admonition>
|
|
You can sign a time-limited URL that you can share to your users by invoking the `createSignedUrl` method on the SDK.
|
|
|
|
```js
|
|
import { createClient } from '@supabase/supabase-js'
|
|
|
|
const supabase = createClient('your_project_url', 'your_supabase_api_key')
|
|
|
|
// ---cut---
|
|
const { data, error } = await supabase.storage
|
|
.from('bucket')
|
|
.createSignedUrl('private-document.pdf', 3600)
|
|
|
|
if (data) {
|
|
console.log(data.signedUrl)
|
|
}
|
|
```
|