         self.state = .authorizationStatePendingExternalApproval
 
         // calculate final url
-        var params = "?scope=\(config.scope)&redirect_uri=\(config.redirectURL.urlEncode())&client_id=\(config.clientId)&response_type=code"
+        var params = "?scope=\(config.scope)&redirect_uri=\(config.redirectURL.urlEncode())&client_id=\(config.clientId)&response_type=code&state=\(requestIdentifier)"
 
         if let audienceId = config.audienceId {
             params = "\(params)&audience=\(audienceId)"


            completionHandler(nil, error)
        }
        // finally, unregister
        self.stopObserving()
    }

public struct AGErrorCodes {
    public static let general = 0
    public static let unknown = 1
    public static let wrongStateParameter = 1
    public static let userCanceled = 100
}

