code: func (idp *IDP) NewChallenge(ctx context.Context, r *http.Request, user string) (challenge *Challenge, err error) {
  	tokenStr := r.FormValue("challenge")
  	if tokenStr == "" {
  		// No challenge token
  		err = ErrorBadRequest
  		return
  	}
  
  	token, err := idp.getChallengeToken(tokenStr)
  	if err != nil {
  		// Most probably, token can't be verified or parsed
  		return
  	}
  	claims := token.Claims.(jwt.MapClaims)
  
  	challenge = new(Challenge)
  	challenge.Expires = time.Unix(int64(claims["exp"].(float64)), 0)
  	if challenge.Expires.Before(time.Now()) {
  		challenge = nil
  		err = ErrorChallengeExpired
  		return
  	}
  
  	// Get data from the challenge jwt
  	challenge.Client, err = idp.getClient(ctx, claims["aud"].(string))
  	if err != nil {
  		return nil, err
  	}
  
  	challenge.Redirect = claims["redir"].(string)
  	challenge.JTI = claims["jti"].(string)
  	challenge.User = user
  	challenge.idp = idp
  
  	scopes := claims["scp"].([]interface{})
  	challenge.Scopes = make([]string, len(scopes), len(scopes))
  	for i, scope := range scopes {
  		challenge.Scopes[i] = scope.(string)
  	}
  
  	return
  }
docs: // Create a new Challenge. The request will contain all the necessary information from Hydra, passed in the URL.