cli icon indicating copy to clipboard operation
cli copied to clipboard

CLI - Authorization failed "Forbidden resource"

Open Nihilis-cs opened this issue 2 years ago • 2 comments

Hello all!

  1. A bit of context:

At first I was solo on the project, and configured the database via Supabase dashboard, and the base is on Supabase, not local. Now that we are 2 on it, I want to be able to manage migrations, generate types from the DB etc... and most important, making that each of us can have our own db locally. (We are newbies, we don't want to mess with the data of the other)

Ran into Supabase CLI, and tried to link my project.

  1. What I did

I installed Supabase Cli & init Supabase:

npx supabase init Then I generated an access token from the dashboard and logged in using it: (or without the access token, result seems the same)

npx supabase login --token sbp_xxxxxxxxxxx And got the following message:

You are now logged in. Happy coding!

  1. What doesn't work (yet)

I then tried to link the supabase project to my local workspace with:

npx supabase link --project-ref "$PROJECT_REF" -p "$SUPABASE_DB_PASSWORD" (Also tried with the project ref hardwritten, without the db password and typing it after etc) and all I got was that:

Authorization failed for the access token and project ref pair: {"message":"Forbidden resource"}

  1. Question

What did I do wrong? Is this a bug from supabase or from between the chair and the keyboard?

Thank you to all of you that will take the time to help me!

Nihilis-cs avatar Jan 06 '24 12:01 Nihilis-cs

Hello, Yes I used login, and got the message "You are now logged in. Happy coding!"

I can't find in the docs what could go wrong. I can't link to the project, I can't use migrations. Each time it's a Forbidden Resource message error, I double checked my credentials.

Le dim. 7 janv. 2024 à 20:12, Xquick @.***> a écrit :

Did you supabase login?

— Reply to this email directly, view it on GitHub https://github.com/supabase/cli/issues/1819#issuecomment-1880145390, or unsubscribe https://github.com/notifications/unsubscribe-auth/AX4TOCWEWKHYGV2KSXOYOBTYNLXRLAVCNFSM6AAAAABBPRDGD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBQGE2DKMZZGA . You are receiving this because you authored the thread.Message ID: @.***>

Nihilis-cs avatar Jan 07 '24 21:01 Nihilis-cs

I think we need more context to debug. Could you run supabase link --create-ticket ...? Once you've done that, share the crash id here.

sweatybridge avatar Jan 07 '24 21:01 sweatybridge

Closing due to staleness.

As a last resort, you can pass in the access token via var. For eg.

SUPABASE_ACCESS_TOKEN=sbp_**** npx supabase@latest link

sweatybridge avatar Apr 18 '24 03:04 sweatybridge