Skip to content

Commit

Permalink
Fix interactive SSO login when creating account from a device (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
braginini authored Nov 22, 2022
1 parent 8b0a1bb commit 53c532b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions management/server/grpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ func (s *GRPCServer) registerPeer(peerKey wgtypes.Key, req *proto.LoginRequest)
}
claims := jwtclaims.ExtractClaimsWithToken(token, s.config.HttpConfig.AuthAudience)
userID = claims.UserId
// we need to call this method because if user is new, we will automatically add it to existing or create a new account
_, _, err = s.accountManager.GetAccountFromToken(claims)
if err != nil {
return nil, status.Errorf(codes.Internal, "unable to fetch account with claims, err: %v", err)
}
} else {
log.Debugln("using setup key to register peer")
reqSetupKey = req.GetSetupKey()
Expand Down

0 comments on commit 53c532b

Please sign in to comment.