SHUBHAM PRAJAPATI
SHUBHAM PRAJAPATI

Reputation: 19

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.

Upvotes: 0

Views: 1634

Answers (2)

semanser
semanser

Reputation: 2358

I wrote a detailed guide on how to do it using Go.

Article: https://depshub.com/blog/using-supabase-auth-as-a-service-with-a-custom-backend/ Source code: https://github.com/DepshubHQ/supabase-jwt-auth-demo

Upvotes: 1

SHUBHAM PRAJAPATI
SHUBHAM PRAJAPATI

Reputation: 19

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

}

Upvotes: 1

Related Questions