MCPcopy Create free account
hub / github.com/PaperDebugger/paperdebugger / CreateRefreshToken

Method CreateRefreshToken

internal/services/token.go:36–46  ·  view source on GitHub ↗
(ctx context.Context, userID bson.ObjectID)

Source from the content-addressed store, hash-verified

34}
35
36func (s *TokenService) CreateRefreshToken(ctx context.Context, userID bson.ObjectID) (*Token, error) {
37 token := &Token{
38 ID: bson.NewObjectID(),
39 UserID: userID,
40 Type: "refreshToken",
41 Token: bson.NewObjectID().Hex(),
42 ExpiresAt: time.Now().Add(time.Hour * 24 * 30),
43 }
44 _, err := s.tokenCollection.InsertOne(ctx, token)
45 return token, err
46}
47
48func (s *TokenService) GetTokenByToken(ctx context.Context, token string) (*Token, error) {
49 var tokenObj Token

Callers 4

TestAuthServerFunction · 0.95
TestTokenService_CRUDFunction · 0.80
LoginByGoogleMethod · 0.80
LoginByOverleafMethod · 0.80

Calls

no outgoing calls

Tested by 2

TestAuthServerFunction · 0.76
TestTokenService_CRUDFunction · 0.64