© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•6mo ago•
2 replies
scornflake

SignatureDoesNotMatch trying to access SB S3, using authenticated users session token

I'm trying to access SB S3 via an authenticaed users session token, using the approach outlined here: https://supabase.com/docs/guides/storage/s3/authentication#session-token

I've verified that I can upload to a specific bucket using a normal accesskey/secret - but I'd prefer to use the users own credentials (JWT) instead of embedding secrets into the browser side.

However; I am seeing a SignatureDoesNotMatch being thrown. In the logs:

        "stack": "Error: The request signature we calculated does not match the signature you provided, Check your credentials. The session token should be a valid JWT token\n    at Object.SignatureDoesNotMatch (/app/dist/internal/errors/codes.js:171:39)\n    at Object.<anonymous> (/app/dist/http/plugins/signature-v4.js:82:36)"
      }
        "stack": "Error: The request signature we calculated does not match the signature you provided, Check your credentials. The session token should be a valid JWT token\n    at Object.SignatureDoesNotMatch (/app/dist/internal/errors/codes.js:171:39)\n    at Object.<anonymous> (/app/dist/http/plugins/signature-v4.js:82:36)"
      }


So I believe I'm calling it OK. My S3 config setup is:

let credentials: {
            accessKeyId: string;
            secretAccessKey: string;
            sessionToken?: string;
        } = {
            accessKeyId: config.accessKeyId,
            secretAccessKey: config.secretAccessKey
        }
        if (config.accessKeyId === "vkfwaufurgmyfqrpmnoo") {
            credentials = {
                accessKeyId: "vkfwaufurgmyfqrpmnoo",
                secretAccessKey: 'anonKey',
                sessionToken: config.secretAccessKey
            }
            // console.log("Using secret access key: " + config.secretAccessKey);
        }
        this.s3Client = new S3Client({
            forcePathStyle: true,
            region: config.region,
            endpoint: config.endpoint,
            requestChecksumCalculation: "WHEN_REQUIRED", // to work around the S3 client trying to use the 'File' as a node based ReadableStream
            credentials: credentials,
        });
let credentials: {
            accessKeyId: string;
            secretAccessKey: string;
            sessionToken?: string;
        } = {
            accessKeyId: config.accessKeyId,
            secretAccessKey: config.secretAccessKey
        }
        if (config.accessKeyId === "vkfwaufurgmyfqrpmnoo") {
            credentials = {
                accessKeyId: "vkfwaufurgmyfqrpmnoo",
                secretAccessKey: 'anonKey',
                sessionToken: config.secretAccessKey
            }
            // console.log("Using secret access key: " + config.secretAccessKey);
        }
        this.s3Client = new S3Client({
            forcePathStyle: true,
            region: config.region,
            endpoint: config.endpoint,
            requestChecksumCalculation: "WHEN_REQUIRED", // to work around the S3 client trying to use the 'File' as a node based ReadableStream
            credentials: credentials,
        });


I am using the latest S3 library, in a vite/react project. Is there something I'm missing?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Session not working from `sb-access-token` cookie
SupabaseSSupabase / help-and-questions
4y ago
sb-access-token,sb-refresh-token VS supabase-auth-token?
SupabaseSSupabase / help-and-questions
4y ago
Any way to access the access_token from session on server ? (Am using Sveltekit)
SupabaseSSupabase / help-and-questions
4y ago
How to refresh the session with no access to `refresh_token`?
SupabaseSSupabase / help-and-questions
3y ago