Skip to content

Commit

Permalink
fix(api): correctly set dbUser tokenId on login
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed Aug 27, 2023
1 parent 6d1d864 commit a36a515
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/api/internal/impl_unprotected/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (c *Auth) AuthGetLink(
request *auth.GetLinkRequest,
) (*auth.GetLinkResponse, error) {
if request.State == "" {
return nil, twirp.NewError(twirp.ErrorCode(400), "no state provided")
return nil, twirp.NewError("400", "no state provided")
}

twitchClient, err := helix.NewClientWithContext(
Expand Down Expand Up @@ -149,7 +149,7 @@ func (c *Auth) AuthPostCode(ctx context.Context, request *auth.PostCodeRequest)
}

dbUser.TokenID = sql.NullString{
String: dbUser.Token.ID,
String: tokenData.ID,
Valid: true,
}

Expand Down Expand Up @@ -185,7 +185,8 @@ func (c *Auth) AuthPostCode(ctx context.Context, request *auth.PostCodeRequest)
c.SessionManager.Put(ctx, "dashboardId", dbUser.ID)

c.Grpc.EventSub.SubscribeToEvents(
ctx, &eventsub.SubscribeToEventsRequest{
ctx,
&eventsub.SubscribeToEventsRequest{
ChannelId: dbUser.ID,
},
)
Expand Down

0 comments on commit a36a515

Please sign in to comment.