func ReadToken(res *http.Response) (*app.TokenData, error) {
	// Read the json out of the response body
	buf := new(bytes.Buffer)
	io.Copy(buf, res.Body)
	res.Body.Close()
	jsonString := strings.TrimSpace(buf.String())

	var token app.TokenData
	err := json.Unmarshal([]byte(jsonString), &token)
	if err != nil {
		return nil, errors.NewInternalError(fmt.Sprintf("error when unmarshal json with access token %s ", jsonString) + err.Error())
	}
	return &token, nil
}
// ReadToken extracts json with token data from the response
ReadToken extracts json with token data from the response
// ReadToken extracts json with token data from the response
func ReadToken(res *http.Response) (*app.TokenData, error) {
	buf := new(bytes.Buffer)
	io.Copy(buf, res.Body)
	res.Body.Close()
	jsonString := strings.TrimSpace(buf.String())
	var token app.TokenData
	err := json.Unmarshal([]byte(jsonString), &token)
	if err != nil {
		return nil, errors.NewInternalError(fmt.Sprintf("error when unmarshal json with access token %s ", jsonString) + err.Error())
	}
	return &token, nil
}
func ReadToken ( res * http . Response ) ( * app . TokenData , error ) { buf := new ( bytes . Buffer ) io . Copy ( buf , res . Body ) res . Body . Close ( ) jsonString := strings . TrimSpace ( buf . String ( ) ) var token app . TokenData err := json . Unmarshal ( [ ] byte ( jsonString ) , & token ) if err != nil { return nil , errors . NewInternalError ( fmt . Sprintf ( " " , jsonString ) + err . Error ( ) ) } return & token , nil }
ReadToken extracts json with token data from the response
ReadToken extracts json with token data from the response
// Read the json out of the response body