Search code examples
gojwtsupabasesupabase-databasegolang-migrate

How to connect supabase with my golang for jwt token verification API from supabase?


There is no any dedicated video or article on this.

I really need this solution.


Solution

  • import (
        "github.com/nedpals/supabase-go"
    )
    
    func verifyTokenSupabase(token string) (*supabase.User, error) {
    
        supabase := supabase.CreateClient(supabaseUrl,supabaseAnonKey)
    
        ctx := context.Background()
        ctx, _ = context.WithTimeout(ctx, 60000*time.Millisecond)
    
        fmt.Println(ctx)
    
        user, err := supabase.Auth.User(ctx, token)
    
        if err != nil {
            return user, err
        }
    
        return user, nil
    
    }