how can i redirect user to the login screen after resetting password from password change ticket. when i try to use result_url with the http call it says underfined field. how can i do this? i am using universal login screens. here’s my code
func createPasswordChangeTicket(clientId, domain, userId string) (*string, error) {
url := "https://" + domain + "/api/v2/tickets/password-change"
method := "POST"
payload := strings.NewReader(`{"user_id":"` + userId + `","client_id":"` + clientId + `","ttl_sec":3600,"mark_email_as_verified":false,"includeEmailInRedirect":false}`)
client := &http.Client{}
req, err := http.NewRequest(method, url, payload)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("authorization", "Bearer "+accessToken)
res, err := client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
var responseData map[string]interface{}
err = json.NewDecoder(res.Body).Decode(&responseData)
if err != nil {
return nil, err
}
if res.StatusCode == 401 {
return nil, errors.New("401")
}
if res.StatusCode != 201 {
return nil, errors.New(fmt.Sprintf("%s", responseData["message"]))
}
ticket := responseData["ticket"].(string)
return &ticket, nil
}