skip to content
Alvin Lucillo

Creating pwd change url

/ 1 min read

💻 Tech

Creating password change URL can be performed with go-auth0 go package:

	b := true
	// connectionId := "connID"
	// userId := "auth0|12345"
	// email := "[email protected]"
	clientID := "clientID123"
	ticket := &management.Ticket{
        // If client is not provided, ConnectionID, UserID, and Email are required
		// ConnectionID: &connectionId,
		// UserID: &userId,
		// Email:               &email,
		UserID: user.ID,
		MarkEmailAsVerified: &b,
		ClientID:            &clientID,
	}
	err = auth.Ticket.ChangePassword(context.TODO(), ticket)
	if err != nil {
		log.Fatalf("failed to create ticket: %v", err)
	}

	fmt.Printf("ticket: %v", ticket.GetTicket()) // the password change URL