具有uaa服务的Jhipster微服务体系结构,灵活的发布方法,access_denied无效的CSRF令牌

时间:2019-04-14 22:53:45

标签: swagger jhipster

我用jhipster v5.8.2生成 UAA服务, 代理人 还有一个我定义了foo实体的微服务。

我的问题是,当我连接到代理时,我会大摇大摆(administration-> api)。并且我正在尝试使用POST方法创建一个新的实体foo。我收到错误403无效的CSRF令牌

class ViewController: UIViewController, CLLocationManagerDelegate {

    let key = "d79ac3fea08fac5d21deeabef00*****"
    var lat = 11.344533
    var lon = 104.33322
    let managLoc = CLLocationManager()

    override func viewDidLoad() {
       super.viewDidLoad()
       managLoc.delegate = self
    }
    @IBAction func locationOption(_ sender: Any, forEvent event: UIEvent) {
       self.managLoc.startUpdatingLocation()
    }

    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        let location = locations[0]
        lat = location.coordinate.latitude
        lon = location.coordinate.longitude
        Alamofire.request("https://api.openweathermap.org/data/2.5/weather?lat=\(lat)&lon=\(lon)&appid=\(key)").responseJSON {
            response in
            if let responseStr = response.result.value {
                let jsonResponse = JSON(responseStr)
                let jsonWeather = jsonResponse["weather"].array![0]
                let jsonTemp = jsonResponse["main"]
                let iconName = jsonWeather["icon"].stringValue

                self.locationLabel.text = jsonResponse["name"].stringValue
                self.typeView.image = UIImage(named: iconName)
                self.typeLabel.text = jsonWeather["main"].stringValue
                self.tempLabel.text = "\(Int(round(jsonTemp["temp"].doubleValue-273.15)))"

                let date = Date()
                let dateFormatter = DateFormatter()
                dateFormatter.dateFormat = "EEEE"
                self.dayLabel.text = dateFormatter.string(from: date)

                }
        }
        self.managLoc.stopUpdatingLocation()
    }

    func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
        print(error.localizedDescription)
    }

}

对于所有POST,PUT,DELETE方法,我都会遇到相同的错误。

请解决方案

0 个答案:

没有答案